|
-
October 20th, 2009, 04:15 AM
#1
[RESOLVED] Store Configuration
Hello to all, i wonder how you all store configuration like port number and others.
The configuration file need to read every the application start.
What kind of configuration format you all recommended ?
What do you think about libConfig ?
Please help.
Thanks.
Last edited by Peter_APIIT; October 20th, 2009 at 04:22 AM.
Thanks for your help.
-
October 20th, 2009, 07:24 AM
#2
Re: Store Configuration
If you're using Windows, the WriteProfileInt and GetProfileInt API calls would work.
-
October 20th, 2009, 09:22 AM
#3
Re: Store Configuration
I´m using a XML library that came with my compiler.
- Guido
-
October 20th, 2009, 11:15 AM
#4
Re: Store Configuration
Registry, ini file, text file, XML, custom format.
For really complicated configuration data XML is possibly the best solution. Microsoft XmlLite SDK makes XML available for C++ programmers with relatively low effort.
To conform Microsoft gudelines, configuration data must be kept in HKEY_CURRENT_USER Registry section, or user Application Data directory. This allows to run the program without Administrator privileges.
I didn't use libConfig, but it's interface looks OK.
-
October 20th, 2009, 09:35 PM
#5
Re: Store Configuration
I go for C++ XML library.
What C++ XML library you all recommend ?
Xerces C++ XML
libxml++
TinyXML
Expact Xml
How to write portable configuration ?
How to write configuration to registry ?
Thanks for all suggestion.
Last edited by Peter_APIIT; October 21st, 2009 at 12:04 AM.
Thanks for your help.
-
October 21st, 2009, 07:26 AM
#6
Re: Store Configuration
I like TinyXML myself, but generally I just use the ol' 'Ini' file format type thingy for configurations.
It's simple and easy to edit with any old text editor.
Writing configurations to the Registry (under Windows) is more and more frowned upon.
Under Windows:
You should write application global settings to a sub-directory under "Documents and Settings\All Users\Application Data\YourCompanyName\YourProgramName".
Application shared files (templates, examples, and such) should go under "
You should write application global settings to a sub-directory under "Documents and Settings\All Users\Shared Documents\YourCompanyName\YourProgramName".
Specific user settings should go under either of those two folders in the individual users Docs&Settings folder.
Pretty much the only things that should go into the registry would be things for OLE Automation, and Uninstall information.
--- libconfig is nice, but I don't like the generated configuration files so much, if I need typing abilities, I'd rather go the extra 40 yards and use XML.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|