casting int to string
Normally i use borland c++ builder and there i use the IntToStr() function
But atm i''m using visual c++, what function do i use here to get this done?
Try _itoa( int, char *, int ), I''m not sure what the underscore is all about, but it should work.
Kory
Kory
If you are using C++:
[ Google || Start Here || ACCU || STL || Boost || MSDN || GotW || MSVC++ Library Fixes || BarrysWorld || E-Mail Me ]
#include <sstream> // for std::stringstream (and std::istringstream, etc.)
int someNumber = ...;
std::stringstream ss;
ss << someNumber;
std::string strNumber;
ss >> strNumber;
[ Google || Start Here || ACCU || STL || Boost || MSDN || GotW || MSVC++ Library Fixes || BarrysWorld || E-Mail Me ]
quote:Original post by Pilatus
itoa(int ,char*,10)
works fine
This question gets asked every week - you should use the search facility to find previous answers. For the record, you should avoid itoa(), which is not a Standard C or C++ function. sprintf and stringstream are.
Nah forget the search feature...It was a simple question and easy for us to answer.
If the question was DX VS OPENGL -> Use the search.
If the question was DX VS OPENGL -> Use the search.
Although this question has been answered, read Bjarne Stroustrup (creator of C++, if you didn''t already know)''s website. He has style & technique FAQ, as well as a Technical FAQ.
Stroustrup''s Homepage (one ugly dude)
Style and Technique FAQ (answers integer to string question)
General FAQ
Stroustrup''s Homepage (one ugly dude)
Style and Technique FAQ (answers integer to string question)
General FAQ
quote:Original post by granat
Nah forget the search feature...It was a simple question and easy for us to answer.
Even more shameful then that three people managed to recommend a non-standard function. We don't need that sort of misinformation on the boards. Last time I looked, the forum name was `For Beginners' not `By Beginners'.
[edited by - SabreMan on July 3, 2003 11:49:46 AM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement