Linux configuration file libraries

28,721

Solution 1

You could try glib's key-value-file-parser

Solution 2

I would recommend 'libconfig'.

Solution 3

Another option is Boost.PropertyTree (doc). It allows to read/write XML, INI, JSON and Info files. And you get portability for free.

Solution 4

Boost program_options This allows you to read program options from config files, environment variables and the command line. It is portable and very easy to use.

Solution 5

If you just want a simple config file, with a list of commands and/or variable settings, then it's very easy to write your own parser, so easy that it's probably not worth using a library. If you need something more complicated then the parser rapidly becomes more complicated and an existing library is worth using.

I've never tried using libconfig, but it looks like a good choice, and I like the format of the config files it uses.

You need to decide whether you want your program to be able to write config files. If it's a GUI program, you probably do. This will affect what libraries are suitable.

Share:
28,721
jcodeninja
Author by

jcodeninja

C, C++, perl, java Developer who prefers to develop for the linux platform.

Updated on November 09, 2020

Comments

  • jcodeninja
    jcodeninja over 3 years

    Are there any good configuration file reading libraries for C\C++ that can be used for applications written on the linux platform. I would like to have a simple configuration file for my application. At best i would like to steer clear of XML files that might potentially confuse users.