ex.
[file.txt]
I have five fingers.
My current code:
Expand|Select|Wrap|Line Numbers
- ofstream File;
- File.open("file.txt", ios::out);
- File.seekp(8, ios::beg);
- File << "four";
- File.close();
a) erases the whole file and writes "four" at the begining or end
b) writes "four" at the very end ("I have five fingers.four")
c) erases the whole file and writes "four" eight characters into the file
I know I can get it to work by reading in the file and going through it word by word, but the actual file is extremely large so processing the whole file is not an option.
Assuming I know the starting byte locations of everything I want to change, byte 8 in this case, how can I get the file.txt to display this:
I have four fingers
Is there any way to do this and avoid using ios::binary?