Saving variables to a text file, or something similar

Hey!

I wanted to ask, what should i do in order to keep the variables same size after the program was closed and reopened?

Im thinking of something like saving data to a text file or something similar using fstream include and then reading the data back to the program on the next load of it.

It would be like a save for a game or something like it.

Any ideas?
Yeah, I would save/load it to/from a file.

http://www.cplusplus.com/doc/tutorial/files/
ok ill try to find what i need, thanks

EDIT: i cant figure it out...

Can someone post me an example of , lets say a save data file named data.sav

1)writing and reading from it
2)getting data from separate lines
Last edited on
Please? Somebody!!!???
firedraco wrote:
http://www.cplusplus.com/doc/tutorial/files/


This tutorial contains examples of writing to the file. You can read the same way you read from cin; they are both streams and work similarly.
Topic archived. No new replies allowed.