12345
char temp[20]; sprintf (temp, "%d", n); // or itoa (n, temp,10); // non standard, but many compilers support itoa
1234
stringstream ss; string str; ss << n; str = ss.str();