Hello,
I have a piece of code that gives a runtime error. Can anyone help find out why?
vector<int> intData;
vector<bool> boolData;
for(int i=0;i<19000;i++)
boolData.push_back(false);
string ofile = "tree.dat";
ofstream fout(ofile.c_str(),ios::out | ios::binary);
if (!boolData.empty()) fout.write((char *)&boolData[0], sizeof(bool)*boolData.size());
fout.close();
It gives the error when it tries to write the file (fout.write).