When using the function atoi (or strtol or similar functions for that matter), how can you tell if the integer conversion failed or if the C-string
atoi
strtol
It's been a while since I've done and C/C++, but it would appear to me that the (overly) simple solution would be to check just the string for "0".
int value = atoi(string_number.c_str()); if ( !value && string_number != "0" ) { // error } else { // great success! }