7

I'm trying to find a simple C/C++ library to parse ini configuration files.

It should:

  • have tests
  • be small (e.g. a .h file and a .cpp file)
  • be easy to use ("standard" ini file parsing is sufficient)
  • be cross-platform and cross-compiler
  • have error checking, possibly exception-less
  • be released under a permissive license (MIT/BSD is OK, GPL is not)

Python has ConfigParser, which is pretty straightforward. I like it.

I've checked Boost, and would like to avoid that (too many dependencies).

Any suggestions?

2

Modern and cross-platform library is also inicpp. It has pretty good test support, is easy to use and one of the greatest features is schema validation (with full type safety). It's not big, but it's more than one .h and .cpp file. License is MIT.

  • If I can include a header for basic stuff, it's OK. Requiring support for C++14 is definitely overkill, though. – Agostino Jun 21 '16 at 7:57
1

The best I could find is inih. The C++ interface is minimal, but it works.

Features:

  • similar to Python's ConfigParser (has Get, GetInteger, ...)
  • it's small, two files .cpp and .h
  • cross-compiler
  • exception-less errors
  • permissive license (BSD)

Lacks:

  • functions for creating .ini files
  • functions to get all sections or all fields at once, but there's a fork for that

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.