C – ATOI () – String to INT

I read that atoi() has been deprecated, it is equivalent to:

(int)strtol(token_start, (char **)NULL, 10);

Does this mean I should use the above instead of atoi(chr) or does it just say that they are equivalent?

It is indeed in Apple’s Mac OS X Manual Page for atoi(3) (and the BSD manual page ) Said atoi has been deprecated.

The atoi() function has been deprecated by strtol() and should not be
used in new code.

I will use strtol() equivalent for this reason, but I suspect you have to worry about atoi() being removed.

From http: //www.codecogs.com/library/computing/c/stdlib.h/atoi.php start
Implementation instructions

* The atoi function is not thread-safe and also not async-cancel safe.
* The atoi function has been deprecated by strtol and should not be used in new code.

I read atoi( ) Has been deprecated, it is equivalent to:

(int)strtol(token_start, (char **)NULL, 10);

Does this mean that I should use the above instead of atoi(chr) or does it just say that they are equivalent?

It is indeed stated in Apple’s Mac OS X Manual Page for atoi(3) (and the BSD manual page) that atoi is deprecated.

The atoi() function has been deprecated by strtol() and should not be
used in new code.

I will use strtol() equivalent for this reason, but I suspect you have to worry about atoi() being deleted.

From http://www.codecogs.com/library/computing/ c/stdlib.h/atoi.php start
Implementation instructions

* The atoi function is not thread-safe and also not async-cancel safe.
* The atoi function has been deprecated by strtol and should not be used in new code.

Leave a Comment

Your email address will not be published.