Ok i got a simple question
how do you change a int to char
Printable View
Ok i got a simple question
how do you change a int to char
itoa()
search MSDN for it
Do you mean a string -- a C++ string?Quote:
Originally Posted by Afan
FAQ > How do I... (Level 1) > Convert a string to a int (C++)
sprintf is standard (or stringstreams).Quote:
Originally Posted by h_howee
typecasting if u did want int to char
I don't know if it's proper, but I like stringstream. Something like this:
Code:#include <sstream>
int x = 3;
std::stringstream s;
//streams x into the string
s << x;
//function to call s is s.str()
cout<< s.str();
Quote:
Originally Posted by h_howee
c:\Documents and Settings\David Brotz\My Documents\Visual Studio Projects\MathChecker 2.0\MathChecker 2.0Dlg.cpp(22): error C2143: syntax error : missing ';' before '.'Code:itoa(Value, Combo01_String*, 10);
For the FAQ one, i dont really understand how it converts so id rather do something i understand.
Is that a type and not a value? Why not sprintf?Quote:
Originally Posted by Afan
maybe you should go with sprintf instead. Daves a better at this than i am
Program on an eight bit platform. int and char should be the same there. :p
There I would especially doubt it.Quote:
Originally Posted by citizen