+ 1
Is there a simple way to save (store) a variable in the 'long term' memory'? (C++)
Hi everyone! I'm sorry for this question, probably it's been asked a million times but I want to know if there's a simple and easy way to save variables in c++ in the 'long term memory' (I mean, be able to close and open the program and still have the same values and information stored in the variables). I've been trying to understand Fstream to do that, however I still don't get it. Maybe fstream is not the solution to this.
3 ответов
+ 5
In order to achive that. Just save the variable in a file and read it next time you run the program.
+ 4
Every variable in your program is destroyed when program ends. You have to make a file and store the value into the file. After you make it you also need to make your program read the file at the start.