There is no automatic way to do this, it has to be explicitly programmed.
In the normal output of the program you write in a file of your choice the data you think will be needed in the next activation of the program, and in the activation you read the file and perform the necessary actions according to what was read, for example, change the current application directory.
To not have to reinvent the wheel it is possible to use a standard format such as JSON and "ini", but in this case it will be worth using an external library to read and write the files, because there are many of these libraries available.
Alternatively you can use the built-in SQLITE database, but in this case the configuration file will not be in text mode. I think this is an interesting alternative.
Note. the Windows environment already provides functions ready for access to "ini" files. So specifically for Windows it is very easy to use "ini" files".
Hello @Astorga, thanks for the help, but I’m looking for "a technique" most commonly used to work with files saving and recovering variables... for example how to find 1 of the 100 variables I have stored, means?
– Camila Yamamoto
@Camilayamamoto in this case you can search for serialization, I think it will make more sense for you. Arquivos . conf are usually simple to interpret: the characters
#
are ignored and parameter names are separated by an arbitrary number of spaces up to the first character. If you can already read and write to files, interpreting a file . conf shouldn’t be a problem for you ;)– astorga
but anyway, I’ll have to "scan" the file.. looking for the string of my var and what it is "matched" to? right?... laborious... neh?
– Camila Yamamoto
That’s precisely what any parser will do for you. What usually happens is that they expose this setting in dictionary format or some simpler structure. Depending on its purpose, libconfig can help you (despite doing much more than just that).
– astorga
Wow? Why did you get hurt? Your answer wasn’t worth? Because it was a great help to me (although it didn’t solve my problem)! Thank you, I think you’ve stayed on topic!
– Camila Yamamoto
@Astorga proposed to help and your answer cannot be considered wrong, so vote +1
– Wendell
good attitude! thanks! @Wendell... just one comment.. I have seen a certain "strange thing": the staff negatively what has to do with the subject, and positive responses totally outside the scope... including some offensives of so aggressive that are.... pity...
– Camila Yamamoto