TCLAP/examples/test18.cpp
zeekec 3431fcfd78 Allow internal handling of parse errors to be turned off.
This allows exceptions for parse errors to be propagated to the caller.  Exiting
the program in parse is a bad idea generally, as we have no way of knowing what
cleanup needs to be done in the main program.
2008-07-21 17:20:57 +00:00

25 lines
443 B
C++

#include <string>
#include <iostream>
#include <algorithm>
#include "tclap/CmdLine.h"
using namespace TCLAP;
using namespace std;
int main(int argc, char** argv)
{
try {
CmdLine cmd("Command description message", ' ', "0.9", false);
cmd.setExceptionHandling(false);
cmd.parse(argc, argv);
} catch (ArgException &e) { // catch any exceptions
cerr << "error: " << e.error() << " for arg " << e.argId() << endl;
return 1;
}
}