...
Note that this solution treats any trailing characters, including white space characters, as an error condition.
References
- Jack Klein. Bullet Proof Integer Input Using strtol(). http://home.att.net/~jackklein/c/code/strtol.htmlKlein 02
- ISO/IEC 9899-1999 Section 7.20.1.4 The strtol, strtoll, strtoul, and strtoull functions; Section 7.19.6 Formatted input/output functions