Originally Posted by knobby67
Hi, I normally programme embedded systems so my variables are saved on in battery backed NVram using a memory map. I've now moved on to these new fangled PC's without memory mapped NVRam. So I'm trying to work out the best way to save data. As far as I can see writting to text/bianry file is the way to do it, but I'm sure someone must have a better way to do it. Thanks in advance if anyone can help me out.
To save your program variables, it's quite common to use ini / conf files, in either the system wide location (/etc
), or in the user's home directory for a per-user experience (~/.program_name
Similarly, if there are a number of groups of settings that should / can be saved, then creating a directory in the user's home directory (~/.program_name/
) and saving to text files in there, is often used. (ie: ~/.program_name/settings1.conf
, and ~/.program_name/settings2.conf
). If the settings are to be global to the system, then saving them to the system-wide location (/etc/program_name/
) in a few files can also work well.
Under Windows, they can mix this approach with the registry for saving settings too.