Click here to Skip to main content
15,902,112 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I am writing an app, which may need to store process user's settings/preferences.
I am interested what is the common way to do it? I assume I will store the preferences
in files. How it is done usually? Which methods etc.
Posted

A common approach uses XML files (usually via a XML library, like for instance MSXML[^] ). Old fashioned applications still use INI files. Another method is serialization[^] (if you are using MFC then you may find serialization is nicely supported).
 
Share this answer
 
Comments
SajeeshCheviry 17-May-13 8:25am    
Good answer..my vote of 5.
CPallini 17-May-13 8:54am    
Thank you.
Solution #1 is correct for internal format of your config data, but doesn't say where to put it. I suggest something like %HOMEDRIVE%%HOMEPATH%\AppData\yourapp\prefs.xml or something similar. Your app should know what to do if the file exists or does not when the app starts. If your app is complex or needs different config file formats, then use multiple files.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900