So I want to check to see if the command line argument I received was an integer. How do I do this?
Code:
#include <iostream>
using namespace std;
int main(int argc, char* argv[]) {
//**************************
//Checking for correct input
//**************************
if ( argc != 2 ) {
cerr << "Usage: " << argv[0] << " n" << endl;
return 1;
}
if ( argv[1].isdigit() != 1 && ) {
cerr << "Usage: n must be a positive integer." << endl;
return 1;
}
}
However, the error message says that there is a request for member isdigit in *(argv + 4u) which is of nonclass type char*.
I don't really understand the error message.