"skyer" <po****@re-comp.com.pl> wrote in message
news:bu**********@atlantis.news.tpi.pl...
Hello !
How to convert int value to string in QT or ANSI C++ library ?
The C standard library function itoa (IntegerToAlpha) is what you're looking
for.
#include <iostream> // cout
#include <cstdlib> // itoa(), system()
using namespace std;
int main(void){ // command line unused
int myNumber = 42;
char myCharString[15]; // empty string 15 char long
cout << "value of myNumber is: " << myNumber << endl
<< "myCharString contains: " << myCharString << endl; // empty
// use itoa (IntegerToAlpha) to convert to string equivalent
itoa( myNumber, myCharString, 10 ); // the 10 is the number base
cout << "myCharString contains: " << myCharString << endl;
// use a different number base
itoa( myNumber, myCharString, 16 ); // hex
cout << "myCharString, base-16: " << myCharString << endl;
system("pause"); // wait for keypress
}