
1 Dec
2010
1 Dec
'10
9:01 a.m.
Hi,
I want to parse a simple string using boost program options. Let the string
to parse look like this
The input string looks like this string str="ARG1=hai ARG2=long string with
space ARG3=12"
This is how the command should be parsed
ARG1="hai"
ARG2="long string with space"
ARG3=12
This is how my program looks like
string in="ARG1=hai ARG2=long string with space ARG3=12";
options_description desc("OPT");
desc.add_options()
("CMD",value<string>(),""),
("ARG",value<string>(),""),
("TYPE",value<int>(),"")
;
variables_map vm;
stringstream ss(in);
store(parse_config_file(ss,desc),vm);
notify(vm);
if(vm.count("ARG1"))
{
cout<<"ARG1:"<