| Branch | Status | Coverage |
|---|---|---|
master |
||
develop |
This project is a library for reading and writing INI files. It is written in C++20 and uses the STL. It is tested with GCC 13, Clang 16 and MSVC 19.36. It should work with any compiler that supports C++20.
The library is able to read INI files and parses them automatically. It is able to read the following types:
boolcharshortintlonglong longunsigned charunsigned shortunsigned intunsigned longunsigned long longfloatdoublelong doublestd::stringstd::string_viewconst char*
Accessing a value is done with the get template-function. It takes the section and the key as parameters and returns
the value as the specified type T. If the value does not exist, the default value (T()) is returned.
Setting a value is done with the set template-function. It takes the section, the key and the value as parameters.
The value is converted to a string and written to the file. If the section or the key does not exist, it is created.
On every write, the file is completely rewritten.
#include <cppIni/cppIni.hpp>
File ini("test.ini");
const auto intValue = ini.get<int>("section", "key");
const auto newValue = 42;
ini.set("section", "key", newValue);#include <cppIni/cppIni_c.h>
void* ini = cppIni_open("test.ini");
const int intValue = cppIni_geti(ini, "section", "key");
const int newValue = 42;
cppIni_set(ini, "section", "key", newValue);
cppIni_close(&ini);cppIni is licensed under the GPLv3. See COPYING for more information.