Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

tekladis/tconfig

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A basic INI reader/writer built in C, with minimal dependencies.

This was an attempt to write something compact and easy to use for reading and writing INI files in my projects.

It's able to read most INI formats without any issues. Comments are delimited by the ';' character.

A basic usage example would be something like this:

int main()
{
    ini_table_s* config = ini_table_create();
    if (!ini_table_read_from_file(config, "test.ini")) {
        puts("test.ini does not exist! Adding entries!");
        ini_table_create_entry(config, "Section", "one", "two");
        ini_table_write_to_file(config, "test.ini");
    }else {
        puts("Entry one is: %s\n", ini_table_get_entry(config, "Section", "one"));
    }
    ini_table_destroy(config);
    return 0;
}

You don't need to check for NULL on ini_table_create(), since it creates an empty structure. Always make sure to call ini_table_destroy() when you're finished using the data, however.

A recent PR allowed reading/writing of comment lines.

For more information on these functions, check out config.h, which I spent a bit of time documenting for easy reading.

Releases

Packages

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.