gpt4 book ai didi

c++ - 首选使用 istrstream 或 strtol/strtod 从字符串中读取数字

转载 作者:搜寻专家 更新时间:2023-10-30 23:50:15 24 4
gpt4 key购买 nike

我必须从字符串中读取数字。哪个是安全且首选的

  1. istrstream
  2. atoi/atof
  3. strtol/strto

请指导我。

最佳答案

我已经使用了所有这些,但不知道哪个更可取。不过,我确实找到了一篇不错的文章 ( here),介绍了最后两者之间的优缺点,非常值得一读

关于c++ - 首选使用 istrstream 或 strtol/strtod 从字符串中读取数字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2461272/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com