read options from config file
halo,
i want to read options from my c-program which are written in an config file in the normal way like most config file for example [foo] bar = xxx are there any functions to do this? thanks in advance |
I don't know about functions that can handle this, but look into string tokenizers.
|
aren't there any other useful functions, because it is used often and in many programs?
|
AFAIK there are none. And think it's a bit strange as well. getopt() exists for a long time, but general config file parser do not exist apparently...
You could copy some functions for it from a free software source. One option that comes close may be to use XML config files and use a XML-parser library. But if your program is simple, this may be an overkill. |
Check out mkxf86config from knoppix.net/sources. It contains two short functions: checkbootparam and getbootparam that are for parsing options from /proc/cmdline.
You can use those or modify to suit. |
All times are GMT -5. The time now is 10:45 PM. |