itoa函数问题 [英] itoa function problem

查看:338
本文介绍了itoa函数问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的C ++项目上使用Ubuntu环境中的Eclipse。

I'm working on Eclipse inside Ubuntu environment on my C++ project.

我使用 itoa (在Visual Studio上完美工作),编译器会提示 itoa 未声明。

I use the itoa function (which works perfectly on Visual Studio) and the compiler complains that itoa is undeclared.

$ c>< stdio.h> ,< stdlib.h> < iostream>

I included <stdio.h>, <stdlib.h>, <iostream> which doesn't help.

推荐答案

www.cplusplus.com说:

www.cplusplus.com says:

此函数在ANSI-C中未定义,不是C ++的一部分,但由某些编译器支持。

因此,我强烈建议你不要使用它。但是,你可以使用 stringstream 这样很简单地实现这一点:

Therefore, I'd strongly suggest that you don't use it. However, you can achieve this quite straightforwardly using stringstream as follows:

stringstream ss;
ss << myInt;
string myString = ss.str();

这篇关于itoa函数问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆