Archived

This topic is now archived and is closed to further replies.

xorjesus

Writing to file is like having insert mode on

Recommended Posts

When using fstream and I write to a file. The writing behaivor is similier to that as if the insert key is activated. As in where-ever the (write)file pointer is, the program will write over any information that is there. How can I get it so it just pushes all the characters forward. Is there some code I''ll have to implement? Thanx in advance :]

Share this post


Link to post
Share on other sites
std::fstream has no built-in mechanism to support what you want to do. You either need to read the whole file into memory and then interleave the stored data with the data to be inserted or write into a temp file, delete the old file and rename the temp file to the old file name.

Share this post


Link to post
Share on other sites