covert to String from printf result

Hi Gentlemen..

I'm average to C++. I have a question to ask for String.

Eg. 1

CString write;
int time = 20;
int counter = 3;

write += "Time ";
write += itoa(time,buffer,10);
write += ":\tProcess ";
write += itoa(counter,buffer,10);
write += " arrive\n";

printf(write);
// This will print "Time 20: Process 3 arrive"

but I want to save the whole sentence just like...

Eg. 2
write = printf("Time %d:\tProcess %d arrive\n",time, counter);

but it printed out rubbish...

How can I solve this, yet don't go so much trouble in Eg. 1?
Please help...
[680 byte] By [primistic] at [2007-11-18 17:37:29]
# 1 Re: covert to String from printf result
CString has a member function called FormatMessage(...)

Use it...

check msdn.microsoft.com for documentation...
Mick at 2007-11-11 1:26:23 >
# 2 Re: covert to String from printf result
Try this:

CString write;
int time = 20;
int counter = 3;

write. Format("Time %d\tProcess %d arrive\n", time, counter);
RussG1 at 2007-11-11 1:27:23 >