inih parses .INI files with a small SAX-style callback API suited to embedded systems. It supports Python ConfigParser-like syntax, optional multi-line values, and heap or stack buffering.
Overview
inih (INI Not Invented Here) reads classic .INI configuration files in C with minimal code size. Callers supply a handler invoked for each section, name, and value triplet as the file is scanned, which keeps RAM use low on constrained devices.
Entry points include parsing from a file path, an open FILE handle, a string buffer, or a custom stream reader. Compile-time defines control multiline entries, BOM handling, inline and line-start comment rules, whether names without values are allowed, error stopping behavior, line numbers in callbacks, and heap versus stack line buffers.
An optional C++ INIReader wrapper stores parsed data in a map for convenient Get accessors. Packaging supports Meson, vcpkg, and tipi.build dependencies for distros and desktop projects.
Platform notes call out that native Windows paths are UTF-16 wide strings, so Unicode filenames require wfopen plus iniparsefile; the C core does not embed full Unicode path handling on its own.
Key features
- Callback-driven INI parsing
- File, string, and stream inputs
- ConfigParser-style multiline syntax
- Compile-time syntax and memory options
- Optional C++ INIReader map wrapper
- Meson and vcpkg distribution
- Custom allocator hooks for heap mode
- RFC 822-style continuation lines
Use cases
- Embedded firmware configuration files
- Small C services reading settings
- Cross-platform tools with .INI configs
- Low-memory streaming config parse