R
rory
I can't seem to append a string to the end of a binary file. I'm using
the following code:
fstream outFile("test.exe", ios::in | ios:
ut | ios::binary |
ios::ate | ios::app)
outFile.write("teststring", 10);
outFile.close();
If I leave out the ios::ate and ios::app modes my string is written to
the start of the file as I'd expect but I want to write the data to
the end of the binary file not the beginning. Can anyone advise me on
what I'm doing wrong? I've also tried using seekp and positioning the
put pointer to the end of the binary file but that doesn't seem to
work either. Any help would be greatly appreciated. Cheers,
Rory.
the following code:
fstream outFile("test.exe", ios::in | ios:
ios::ate | ios::app)
outFile.write("teststring", 10);
outFile.close();
If I leave out the ios::ate and ios::app modes my string is written to
the start of the file as I'd expect but I want to write the data to
the end of the binary file not the beginning. Can anyone advise me on
what I'm doing wrong? I've also tried using seekp and positioning the
put pointer to the end of the binary file but that doesn't seem to
work either. Any help would be greatly appreciated. Cheers,
Rory.