|
-
Mar 4th, 2003, 10:04 AM
#1
Thread Starter
Addicted Member
numbers to string
if you want to print numbers in MessageBox() or TextOut(), how do you do this? i mean not just a number, but putting a variable into the parameter of the aforementioned functions.
thanks,
jmiller
-
Mar 4th, 2003, 10:09 AM
#2
Frenzied Member
Code:
char tmp[30];
int i = 32;
sprintf(tmp,"%d",i);
MessageBox(hWnd,tmp,NULL,MB_OK);
-
Mar 7th, 2003, 02:39 PM
#3
Code:
ostringstream tmp;
int i = 32;
tmp << i;
MessageBox(hWnd,tmp.str().c_str(),NULL,MB_OK);
Get the full power of streams
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Mar 9th, 2003, 02:57 PM
#4
Thread Starter
Addicted Member
sorry, but that doesn't answer my question.
what i really need to do is add a number on to a string. In VB it would have been like:
dim z as String
dim x as integer
z = "blah"
x = 1
z = z & x
and CornedBee, for some reason my compiler(vc++6) doesn't recognize ostringstream. what header do i include?
-
Mar 9th, 2003, 03:08 PM
#5
Thread Starter
Addicted Member
nevermind, i've got it. i didn't include <sstream>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|