
28 Nov
2009
28 Nov
'09
4:47 p.m.
Dejan wrote:
Hi all,
I'm experimenting with program_options and trying to get something like "mandatory options". E.g.
# my_prog -a someValue
with "-a someValue" as mandatory options. Can I define "something" with program_options.
Try reading the documentation. The first example in the tutorial does exactly that: if (vm.count("compression")) { cout << "Compression level was set to " << vm["compression"].as<int>() << ".\n"; } else { cout << "Compression level was not set.\n"; } That's the "else" part of the test.