
On Sun, Aug 23, 2009 at 7:08 PM, Shaolin<shaolinfinest@gmail.com> wrote:
Ok, I have managed to get it to work, however, the file param only accepts one value. How can I get several different values for one param ? e.g. --file file1.txt file2.txt file3.txt
if (vm.count("file")) { cout << "Files selected: "; vector<string> files = vm["file"].as< vector<string> >(); for(int i=0; i<files.size(); ++i) { cout << files[i]; } cout << "\n"; }
2009/8/24 OvermindDL1 <overminddl1@gmail.com>
On Sun, Aug 23, 2009 at 6:36 PM, OvermindDL1<overminddl1@gmail.com> wrote:
LLVM. Er, ignore that, was typing up 3 emails at the same time and got my wires crossed, I mean Boost.Program_Options. :)
As-is I bet it accepts it like: --file file1.txt --file file2.txt --file file3.txt If you want to to accept arguments like: file1.txt file2.txt file3.txt, assuming you have no other repeatable types, then you need to specify a positional arguments function for file, like: positional_options_description pd; pd.add("file", -1); The Boost.Program_Options documentation details all of this.