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:"<<vm["ARG1"].as<string>()<<endl;
}
But it prints ARG1:hai ARG2=long string with space ARG3=12
How can I split it into different options?
Thanks in advance,
Lloyd