Perhaps you could take a look at Boost.PropertyTree which will enable you to parse this kind of .ini file (also xml and a number of other formats):

http://www.boost.org/doc/libs/1_43_0/doc/html/property_tree.html

This will give more flexibility about specifying about parsing options without having to specify beforehand which options to expect.


> Date: Tue, 27 Jul 2010 18:48:53 -0700
> From: richard.ringo.langly@gmail.com
> To: boost-users@lists.boost.org
> Subject: [Boost-users] program_options, multiple [sections] from a config file
>
>
> I'm using boost program_options 1.41 and would like to know if anyone has a
> better idea than what I'm trying to do. I am reading from a config file some
> basic parameters per section, but I have multiple sections. The problem is
> there could be any number of [sections] in this file, so I don't know what
> it is ahead of time.
>
> [server]
> name="a"
> ip="1.2.3.4"
>
> [server_2]
> name="b"
> ip="4.5.6.7"
>
> [server_3]
> name="c"
> ip="8.9.0.1"
>
>
> Thanks,
>
>
> --
> View this message in context: http://old.nabble.com/program_options%2C-multiple--sections--from-a-config-file-tp29282201p29282201.html
> Sent from the Boost - Users mailing list archive at Nabble.com.
>
> _______________________________________________
> Boost-users mailing list
> Boost-users@lists.boost.org
> http://lists.boost.org/mailman/listinfo.cgi/boost-users


De nieuwste Internet Explorer: snel, eenvoudig en veilig. Download nu!