Configuration (config) files are used to configure the parameters and initial settings for applications. A user of configuration files needs the ability to view or edit the config files by hand. The Serialization format of these configuration files is therefore very important and needs to be simple and quick. Here you would typically want to use one of the already established formats. There are quite a few of them and all have their pros and cons. So how do you pick the right one? I use the KISS principle to choose and thus will use TOML going forward where YAML was a close second.
- INI - a common configuration file format composed of sections, properties, and values.
- TOML - TOML aims to be a minimal configuration file format that’s easy to read due to obvious semantics. TOML is designed to map unambiguously to a hash table.
- YAML - a superset of json with support for complex data types and structures
Configuration parser libraries
- libconfini - using the reactor callback pattern to parse ini Files
- qlibc - great library (see qconfig.c) that also parses apache style configuration files
- libU - multi-platform utility library written in C - rather dead
- jansson - C library for encoding, decoding and manipulating JSON data
- parson - Lightweight JSON library written in C.
- libtoml - Fast C parser using Ragel to generate the state machine.
- cpptoml - A header-only C++ library for parsing TOML configuration files.
- tinytoml - A header only C++11 library for parsing TOML configuration files.
- tomlc99 - Fast c parser in C99.