use these arguments for mainint main (int argc, char** argv)argc holds the number of arguments passed to the program argv holds an array containing the arguments passed to your program as character sequences argv[0] contains the executable path and name so all the commands start from argv[1]
int main (int argc, char** argv)
{
if (argc == 2)//You have a command
{
if ( !strcmp(argv[1],"command1") ) //the argument is "command1"
//do something
elseif ( !strcmp(argv[1],"command2") )
//do something else
else
{
cout << "Invalid command";
return 2; //Not OK
}
}
else
{
cout << "You should give a command";
return 1;//Not OK
}
return 0;//OK
}