I am looking for a good config file library for c that is not xml. Optimally I would really like one that also has python bindings. The best option I have come up with is to use a JSON library in both c and python. What would you recommend, or what method of reading/writing configuration settings do you prefer?
views:
278answers:
4
+1
Q:
What is a good configuration file library for c thats not xml (preferably has python bindings)?
A:
You could use a pure python solution like ConfigObj and then simply use the CPython API to query for settings. This assumes that your application embeds Python. If it doesn't, and if you are shipping Python anyway, it might make sense to just embed it. Your C .exe won't get that much bigger if it's a dynamic link, and you will have all the flexibility of Python at your disposal.
Christopher
2009-08-04 12:29:52
A:
Despite being hated by techies and disowned by Microsoft, INI files are actually quite popular with users, as they are easy to understand and edit. They are also very simple to write parsers for, should your libraries not already support them.
anon
2009-08-04 12:35:56
-1: ini files have weird limitations that make them hard to work with except in really simple cases. For those simple cases, a Python file full of assignment statements might be better.
S.Lott
2009-08-04 12:46:39
Well they seemed to work OK for PHP and Samba, for instance. And what are those weird limitations?
anon
2009-08-04 12:48:18
The structure of an INI (as parsed by configfile) is flat. No structure. So sections have composite names to impose a structure. The logging initialization file, for example, is hard to edit correctly because the section names depend on other ini settings.
S.Lott
2009-08-04 13:58:34