How can I parse a simple configuration file (with less than 10 options) in Win32...?
Thanks for help in advance!
Printable View
How can I parse a simple configuration file (with less than 10 options) in Win32...?
Thanks for help in advance!
I would start by loading the file into memory.
Does the file have a new config variable on every new line? If so, you can just read the first characters, up to white space into a string as the variable name, with what follows as the value.
I'm assuming the file looks something like this:
Config.cfg
Variable1 = 0
Variable2 = somestring
Variable3 = true
Variable4 = 34
That's how I'd get started. I'll leave variable types and such up to you
There's a Config library, not very refined yet, in the Boost libraries, which can read options from config files.
CornedBee :You mean Program_options?? I really can't find the correct library...:(
Yep, Program Options it is. It can read files too.
http://www.boost.org/doc/html/program_options.html
Thanks, but the next problem seems to be linker, which doesn't want to link compiled program (even if I add libboost.a to project and copy boost.dll to project's bin dir...)...My IDE is Dev-C++....