How to modify this c++ code so it doesn't overwrite the whole file
- by Phenom
ofstream f("test",app);
f.seekp(5,ios::beg);
f << "hello world";
f.close();
What I'm trying to do here is open a file that already has data in it, and then put "hello world" somewhere in the middle of the file. However, when I run my code, it overwrites the whole file. How can this code be fixed?