1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
#include <metaCommand.h>
.....
void function2 (int argc, char **argv, struct arguments & args)
{
MetaCommand command;
command.SetOption("Name","k",true,"...");
command.AddOptionField("Name","boolval",MetaCommand::BOOL,true,"1");
std::cout << "before EXIT " << std::endl;
if (!command.Parse(argc,argv)) // Parse est fonction de metaCommand
{
std::cout << "Inside EXIT " << std::endl;
exit( EXIT_FAILURE );
}
std::cout << "after EXIT " << std::endl;
args.name = command.GetValueAsBool("Name","boolval");
}
int main( int argc, char *argv[] )
{
struct arguments args;
function2 (argc, argv, args);
.....
return EXIT_SUCCESS;
} |
Partager