Here's sprintf().
Code:
#include <stdio.h>
#include <iostream>
using namespace std;
int main(void)
{
int num = 123;
char str[15];
sprintf(str,"%d",num);
cout << "str:" << str << endl;
return 0;
}
I don't have stringstream with my compiler, so maybe Sorensen can show you that one. I have strstream though. I think it's almost the same, except I think the line where I have:
strstream s(str,15,ios::out);
It's just:
stringstream s;
Code:
#include <iostream>
#include <strstream.h>
using namespace std;
int main(void)
{
int num = 123;
char str[15];
strstream s(str,15,ios::out);
s << num;
cout << "str:" << str << endl;
return 0;
}