Saturday, February 11, 2012

Trying to read/write configuration files?

Loading, parsing and writing configuration files is generally not a trivial task. I found this amazing library recently, which does the job with a few C++ lines.

For example, if you have a configuration file such as:

Fields can be easily read with something as simple as:

A major advantage is that it is possible to define groups of configuration parameters, as well as arrays. The library is very well documented and it is very easy to adopt it to existing code.