Code Monkey home page Code Monkey logo

tconfig's Introduction

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.

tconfig's People

Contributors

carmiker avatar gimli2 avatar jochembroekhoff avatar teklad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

tconfig's Issues

Add LICENSE

There is no license here, which means legally nobody can use this code since it is copyrighted (at least in the U.S.)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.