A simple, lightweight .INI file parser written in C, designed for embedded systems.
inih is a lightweight .INI file parser written in C, designed to parse configuration files efficiently with minimal resource usage. It solves the problem of reading INI-formatted settings in embedded systems and other memory-constrained applications where larger parsing libraries are impractical. The library uses a SAX-style callback mechanism, processing entries without loading the entire file into memory.
Developers working on embedded systems, IoT devices, or any C/C++ project requiring a simple, low-overhead configuration parser. It's also suitable for applications where minimal dependencies and small binary size are critical.
Developers choose inih for its tiny code footprint, configurability, and reliability in resource-limited environments. Unlike heavier parsing libraries, it offers essential INI parsing features without bloat, making it ideal for systems where every byte counts.
Simple .INI file parser in C, good for embedded systems
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
The entire parser is only a few pages of C code, making it easy to audit and integrate into security-critical or resource-constrained projects, as highlighted in the README.
Uses a callback-based approach that processes name=value pairs without loading the entire file into memory, ideal for embedded systems with limited RAM, per the project's design philosophy.
Offers compile-time options to enable or disable features like multi-line entries, BOM handling, and inline comments, allowing fine-tuned control over parsing behavior.
Supports parsing from files, strings, or custom streams via dedicated functions (e.g., ini_parse_file, ini_parse_string), providing versatility for different I/O scenarios.
The included INIReader class is minimal and not actively maintained by the author, who recommends forks for advanced features like GetSections(), adding friction for C++ users.
Has key differences from Python's ConfigParser, such as allowing no-section items and handling line continuations as separate values, which can break cross-compatibility for some use cases.
Requires preprocessor defines to adjust features, adding setup complexity compared to parsers with runtime options, and may involve rebuilding for different environments.