itoa function problem

前端 未结 6 1172
北海茫月
北海茫月 2020-12-20 14:08

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

I use the itoa function (which works perfectly on Visual Studio) and the compiler c

6条回答
  •  忘掉有多难
    2020-12-20 14:27

    www.cplusplus.com says:

    This function is not defined in ANSI-C and is not part of C++, but is supported by some compilers.

    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();
    

提交回复
热议问题