c++ - program_options - "invalid option value" when has to read array from file -


i'm trying read array configuration file shows message: " in option 'param_array': invalid option value ".

the topic doesn't helps me because reads array command line.

the code (only important lines) this:

typedef boost::numeric::ublas::bounded_vector<double,6> vec6;  po::options_description parameters("options"); parameters.add_options() ("param_array", po::value< vec6 >(&configparameters.param_array), "parameters array comment") ; 

then have lines too:

po::options_description config_file_options;     config_file_options.add(parameters);   // parser command line options po::variables_map vm; po::store(po::command_line_parser(ac, av).           options(cmdline_options).run(), vm); po::notify(vm);   // verify if config file passed option if (vm.count("config")) {      const std::vector<std::string> &config_files = vm["config"].as< std::vector<std::string> >();      for(std::vector<std::string>::const_iterator = config_files.begin();         != config_files.end(); ++it) {          ifstream ifs(it->c_str());         if (!ifs)         {             cout << "can not open config file: " << *it << "\n";             exit(1);         }          // parse options on config file.         // note: not going updated if set command line option         po::store(parse_config_file(ifs, config_file_options), vm);         po::notify(vm);         }     } 

and finally, configuration file (.yaml) has: param_array= (0,0,0,0,0,0)

i've tried: param_array= {0,0,0,0,0,0} , many other formats.

i solved problem. little annoying blank space between each number, "{}" should "()" , missed size indication of array param_array.

i had:

param_array= {0, 0, 0, 0, 0, 0} 

but configuration file should like:

param_array=[6](0,0,0,0,0,0) 

thank anyway , hope in future.


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -