Interesting. When I run your code I get:
My first thought was using strtol() but because it's returning a long I took another look at the sscanf() man page to check if it does any error reporting and that's how I found out about the ERANGE.Code:$ ./foo
2147483647
9223372036854775807
Enter number: 2147483648
Number out of range, try again: Numerical result out of range
Enter number: 9223372036854775807
Number out of range, try again: Numerical result out of range
$ /lib/i386-linux-gnu/libc.so.6
GNU C Library (Ubuntu EGLIBC 2.13-20ubuntu5.2) stable release version 2.13, by Roland McGrath et al.
Bye, Andreas