The code above will print a number depending on the number of arguments added to it. However I am writing a game in c++/python and I need the program to accept a integer argument that will define the current level the player is on. May someone please show me how?
Use stringstreams for formating.Argc will always contain the number of arguments passed to the program at the command line so you can't use that directly.Argv is an array in which you can index an argument like this:
Use a stringstream for formatting the input instead
std::istringstream (argv[argc-1]) >> value;
//returns the last argument in this case and converts it to an integral type