物理の駅 by onsanai

Physics-station 研究で日々感じたことを忘れないための備忘録

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