I have some legacy C++ code that accepts input parameters. It is in the following format:
int main(int argc,char* argv[])
{
parse_args(argc,argv);
return 0;
}
The inputs had to be specified in the following format:
$ ./a.out -f sample.txt -o out.xml
Now, I need to modify the above code to be able to accept inputs specified in an input configuration file using the boost::program_options::parse_config_file function such that the input can be specified as:
$ ./a.out -cfg config.cfg
Where the content of the file 'config.cfg' is as follows:
f=sample.txt
o=out.xml
I would like to do this without making any changes to the parse_args()
function.
Hence, could you please suggest a method to convert the input arguments parsed from the cfg file (consider it to be a vector of strings) into a format equivalent to that of char* argv[]
?