atoi

(thing) by ariels Mon Sep 24 2001 at 7:38:26
C standard library function, supposedly for converting a (decimal) string into an integer.

It is generally not a good idea to use this function! What it really does is convert the initial segment of the string that is composed of digits (possibly preceded by a sign) to an int. In particular, atoi("not a string") returns 0, not an indication of error.

strtol doesn't suffer from this problem.

Y'know, if you log in, you can write something here, or contact authors directly on the site. Create a New User if you don't already have an account.