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.