Writing game saves to a file

With file streaming and writing, how can I read on the a specific section and then alter it?

E.G.:
1
2
3
4
5
file
..................
Last player position
"100100   111101"
.................


and then changing one section

1
2
3
4
5
file
..................
Last player position
"1000001   1000001"
.................


well how about the following:

Imagine your save data is always saved in the following format:

Character Name
Level Number
Checkpoint in level number
strength stat
...

So using the above example, one characters save data file could look like the following:
1
2
3
4
"Dave"
3
2
99



Another would look like:
1
2
3
4
"Bob"
0
0
1


I think it is easy to gauge where they are in the game roughly right?

Well now for altering:

Imagine Bob completes the first level, you would read his data file one line at a time until we get to the one corresponding with the level number (2nd line).

Now we have the marker at the relevant position, we can simply insert the data required (google "how to edit a text file in c++"). Voila we have an altered file :)
Topic archived. No new replies allowed.