CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2007
    Location
    Mars NASA Station
    Posts
    1,436

    [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.

  2. #2
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,637

    Re: Store Configuration

    If you're using Windows, the WriteProfileInt and GetProfileInt API calls would work.

  3. #3
    Join Date
    Nov 2006
    Location
    Essen, Germany
    Posts
    1,344

    Re: Store Configuration

    I´m using a XML library that came with my compiler.
    - Guido

  4. #4
    Join Date
    Jul 2002
    Posts
    2,543

    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.

  5. #5
    Join Date
    Apr 2007
    Location
    Mars NASA Station
    Posts
    1,436

    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.

  6. #6
    Join Date
    Apr 2005
    Posts
    107

    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
  •  





Click Here to Expand Forum to Full Width

Featured