easy file question

Started by
2 comments, last by Mulligan 20 years ago
using c++, i have a text file that i want to have text inserted into at the begining of the file. How do i set the stream output to the beginging of the file? ie. if i wanted to insert the string "Hello there you" into tedxtfile.txt, the result would be textfile.txt: "Hello there you" sdfjh dsf asd f sdfksjdfkjsdf sdfsdfdsf thanks
Advertisement
honestly, using nothing but standard function you cannot do this operation "in place" ... you must use a temporary file to do it - ie: make a temp file, copy first stuff into it, copy old file into it, close it, delete old file, move temp to old filename.

sucks doesn''t it
Or read the whole file into memory and spit it back out again. Either way, there isn''t direct support for insertion into a file within standard C++.
strange, ive never run into this problem before, thanks!

---------------------------------------------------------

check
out
these
pictures
of
mine

This topic is closed to new replies.

Advertisement