C++写二进制文件
std::ofstream fout("a.dat", std::ios::binary);
int nNum = 20;
std::string str("Hello, world");
fout.write((char*)&nNum, sizeof(int));
fout.write(str.c_str(), sizeof(char)*(str.size()));
fout.close();std::ofstream fout("a.dat", C++写二进制文件
std::ofstream fout("a.dat", std::ios::binary);
int nNum = 20;
std::string str("Hello, world");
fout.write((char*)&nNum, sizeof(int));
fout.write(str.c_str(), sizeof(char)*(str.size()));
fout.close();std::ofstream fout("a.dat",