加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c – atoi() – 字符串到int

发布时间:2020-12-16 09:09:47 所属栏目:百科 来源:网络整理
导读:我读到atoi()已被弃用,它相当于: (int)strtol(token_start,(char **)NULL,10); 这是否意味着我应该使用上面而不是atoi(chr)或者它只是说它们是等价的? 解决方法 它确实在Apple的 Mac OS X Manual Page for atoi(3)(以及BSD手册页)中说过atoi已被弃用. The
我读到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.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读