物理の駅 Physics station by 現役研究者

テクノロジーは共有されてこそ栄える

Visual Studio C++ x64のstd::ofstream のwriteには2GBの壁はない

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();