[SOLVED] Why is there no strtoi in stdlib.h?


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 type 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.

Answered By – Wiz

Answer Checked By – Dawn Plyler (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published.