____ ____ ____ | || _ \ | | | | | | | | | |____||__|__||____|
ini.h
is a header-only C/C++
library for working with INI files. It allows you to read, write and modify INI files using a simple and user friendly interface.
C/C++
compiler supportingC99/C++11
or higherini.h
has no external dependencies
To use the library, just copy the ini.h
file to your project and include it using the #include directive:
#include "ini.h"
; https://en.wikipedia.org/wiki/INI_file
; last modified 1 April 2001 by John Doe
[owner]
name = John Doe
organization = Acme Widgets Inc.
[database]
; use IP address in case network name resolution is not working
server = 192.0.2.62
port = 143
file = "payroll.dat"
#include <stdio.h>
#include "ini.h"
int main(void)
{
ini_t ini = ini_parse_from_path("example.ini");
if (ini != NULL) {
ini_set(ini, "account", "user", "example");
ini_set(ini, "account", "email", "example@example.com");
ini_store_to_file(ini, stdout);
ini_free(ini);
}
return 0;
}
[owner]
name = John Doe
organization = Acme Widgets Inc.
[account]
user = example
email = example@example.com
[database]
file = payroll.dat
port = 143
server = 192.0.2.62
The project is distributed under the MIT license. See LICENSE file for details.