标准库 itoa 函数

发布于 2024-08-10 12:53:03 字数 279 浏览 4 评论 0原文

我在网上搜索并看到很多使用 itoa() 函数的代码&他们声称这个函数在 stdlib.h 中

我现在使用 2 个版本的 GCC:

  1. (GCC) 4.2.4 (Ubuntu 4.2.4-1ubuntu4))

  2. (GCC) 4.1.2 20080704 (Red Hat 4.1.2-44)

以及两者它们没有 itoa() 函数(我编译程序并错误:未定义对“itoa”的引用)。

有什么想法吗? 谢谢。

I searched on internet and saw a lot of code that uses itoa() function & they claimed that this function is in stdlib.h

I'm using 2 versions of GCC right now:

  1. (GCC) 4.2.4 (Ubuntu 4.2.4-1ubuntu4))

  2. (GCC) 4.1.2 20080704 (Red Hat 4.1.2-44)

and both of them does not have itoa() function (I compile the program & error: undefined reference to `itoa').

Any ideas?
Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

蓝海 2024-08-17 12:53:03

itoa() 不在标准 C 中 - snprintf() 是在其位置使用的函数(至少它可能是最简单的更改)。

itoa() isn't in standard C - snprintf() is the function to use in its place (at least it's probably the simplest change to make).

指尖上的星空 2024-08-17 12:53:03

Wikipedia 给了你一个解释:它是一个非标准函数,但编译器通常通过标头提供它 处于非一致模式时。

Wikipedia gives you an explanation: it's a non standard function, but compilers often provide it through the header <stdlib.h> while in non-conforming mode.

我不是你的备胎 2024-08-17 12:53:03

这里是关于这个问题的好文章,从短语“How do I use itoa() with海湾合作委员会?”。文章还提供了几种 itoa() 的实现,性能比较均匀,请看一下。

Here is good article regarding this problem starting from phrase "How do I use itoa() with GCC?". Article also provides several itoa() implementations with even performance comparison, please take a look.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文