The limitation of the size for the std::ofstream write is not 2GB in Visual Studio 2017. The limitation would be 64bit limits.
std::vector<uchar> v(0x100000000); // 4GB (=2^32) std::ofstream ofs("o", std::ios::binary); ofs.write((char*)&v[0], v.size()); //OK ofs.close();