我读到atoi()已被弃用,它相当于:
(int)strtol(token_start,(char **)NULL,10);
这是否意味着我应该使用上面而不是atoi(chr)或者它只是说它们是等价的?
解决方法
它确实在Apple的
Mac OS X Manual Page for atoi(3)(以及BSD手册页)中说过atoi已被弃用.
The atoi() function has been deprecated by strtol() and should not be
used in new code.
我会因为这个原因使用strtol()等效,但我怀疑你不得不担心atoi()被删除.
从http://www.codecogs.com/library/computing/c/stdlib.h/atoi.php开始
实施说明
* 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.