Reading and writing to the same file?

Is there a way to read and write to the same file?

I'm writing a game program and I want to save the score at the end of the game to a txt file. The txt file already contains other game scores. How do I store the score without overwriting the previous scores.

I'm just using basic fstream.

Thank You!

You don't have to go to the physical file every time.
Read the file in memory and keep manipulating things. When the game closes, flush everything to the file.
Topic archived. No new replies allowed.