Jump to content
  • Advertisement

Archived

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

xorjesus

Writing to file is like having insert mode on

This topic is 5265 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!