Reputation: 39
what is the simplest way to store variables persistently? In my case i just want to store some strings for a config which can be accessed when my program gets restarted. I have read about writing and reading txt files, but I was wondering if there is not an even more convienient way to do it?
Upvotes: 0
Views: 144
Reputation: 144715
Saving configuration data is handled differently in different operating systems:
on Unix systems, it is customary to use a text file in the home directory of the user with the values of the configuration settings, in a readable format, allowing for comments, and preferably keeping them across updates.
on Windows, albeit the same method works fine, there is a facility called the registry with various APIs to save and restore settings. For portability and usability, it is probably simpler to use a configuration file on legacy systems too.
Upvotes: 2