ofstream adding in start of file
-
I wish to add single string to the start of a file. I used: _file.seekp(0); // move to start of file _file << something << std::end; It overrides the text in start of file, but I wish to insert before current text. Does anyone know how to do it? THANKS! Keep it simple
-
I wish to add single string to the start of a file. I used: _file.seekp(0); // move to start of file _file << something << std::end; It overrides the text in start of file, but I wish to insert before current text. Does anyone know how to do it? THANKS! Keep it simple
SimpleProgramer wrote: I wish to add single string to the start of a file. I used: _file.seekp(0); // move to start of file _file << something << std::end; It overrides the text in start of file, but I wish to insert before current text. Does anyone know how to do it? There is nothing before 0 (which is even a philosophical answer :suss: ). Hint: You can write a new file ....