http://www.cplusplus.com/reference/clibrary/cstdlib/atoi/
Return Value
On success, the function returns the converted integral number as an int
value.
If no valid conversion could be performed, a zero value is returned.
If the correct value is out of the range of representable values, INT_MAX or INT_MIN is returned.
So how I differ between atoi("poop")
and atoi("0")
and atoi("0000000")
Yes I can loop and check for all zeroes in case I get 0 result, but isn't there a better way?
Notice: I use ANSI C89
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…