I have a line being read from the command line that contains 4 strings. The first is the command name, the second is supposed to be an integer value, the 3rd is the path to the source file, and the 4th is the path to the destination file. All of these arguments are being read in and stored in char * variables. The 2nd argument on the command line is the integer value. This is read in and stored as a char *, but is then converted into an integer by use of the atoi function. The problem is that I need to check if this argument is a valid positive integer before converting it to an actual integer. For example...
commandname 55 source destination ... "55" is valid so the command can be executed
commandname somenum source destination ... "somenum" is not a valid integer so the command can't be executed
... My question is, how can check if a char * is a positive integer before using the atoi function? I tried looking up some functions related to isalnum(), but none of those seemed to be what I was looking for.