I have grown accustomed to strtod
and variants.
I am wondering why there is no strtoi shipped with stdlib.h.
Why is it that the integer is left out of this party?
Specifically I am asking why there is not a version of atoi with the safety features of strtod.
strtol()
converts a string to an integer, a long integer but an integer nevertheless. There is atoi()
but it should be avoided in most cases due to the fact that it lacks a mechanism for error reporting from invalid input.