i am trying to use atoi to convert a string into an int, and then check if the string was indeed all integers.
Here is my code:
printf("Please input the port: ");
scanf("%s",port_number);
int i = atoi(port_number);
if(i != port_number)
{
errno = ERR_INVALID_PARAM;
printf("Error invalid port number\n");
}
However, even when my string "port_number" is an integer, it still goes in the if statement? Any help?