I need to check if a C string is a valid integer.
I tried both
int num=atoi(str);
and
int res=sscanf(str, "%d", &num);
But sending the string "8 -9 10"
in both of the lines returned simply 8, without indicating the invalidity of this string.
Can anyone suggest an alternative?