Code:
outF.open("file.dat", ios::out | ios::binary | ios::ate);
//outF.seekp(0, ios::end);
outF.write((const char *)&num, sizeof(num));
num = 3;
outF.write((const char *)&num, sizeof(num));
outF.close();
Why the open("file.dat", ios:
It always write from the start of the file! Yes, I know it can easily be done with ios::app in open function, but why?