[program_options] How to extract option value?

3 May
2011
3 May
'11
8:30 p.m.
In order to get the option value I have this code: options_description opd; string in; opd.add_options() ("help","Display help") ("input_file,I",value<string>(),"Input file with group division"); variables_map vm; store(parse_command_line(argc,argv,opd),vm); notify(vm); if(!vm["help"].empty()) cout<<opd<<'\n'; else in = vm["input_file"].as<string>(); However the last line issues this exception: terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::bad_any_cast>
' what(): boost::bad_any_cast: failed conversion using boost::any_cast
What do I wrong? -- Regards Krzysztof J.
5150
Age (days ago)
5150
Last active (days ago)
0 comments
1 participants
participants (1)
-
Krzysztof