Daniel
Daniel

Reputation: 4314

C: library for parsing configuration files and command line

I'm looking for some library with support for strict set of options (so non-existent options couldn't be set in config file) and possibility to also parse command line to override options from config file. Any ideas?

Upvotes: 1

Views: 1410

Answers (2)

jørgensen
jørgensen

Reputation: 10549

For command line, there is getopt or plentiful of code, some with more, some with less strange APIs, some in the form of open-codedness like getopt, others in table form with or without callback ability. As for config file, there is (lib)augeas if you need support for almost arbitrary formats.

Upvotes: 1

tbert
tbert

Reputation: 2097

Assuming you can use LGPL stuff in your project, there's http://www.hyperrealm.com/libconfig/, which appears, according to the docs, to have support in the API for setting values after a file has been parsed.

Upvotes: 0

Related Questions