I'm building a program that requires the inclusion of some input parameters. This is a C++ example:
int main(int argc, char *argv[]){
if(argc == 1){
//Run programm without any parameter
}
else{
/*
*Flags
*/
if(!strcmp(argv[1], "-t")){
//action t
return 0;
}
if(!strcmp(argv[1], "-q")){
//action q
return 0;
}
//and soo
}
std::cerr << "Parameter not valid!" << std::endl;
return 1;
}
There is a better (except for the switch) to take? Thanks :)