Converting numbers to "characters"
hello all,
I''m creating D3D game, and I''m checking the display mode to make sure that the user supports the mode. However, if the test fails i would like to display a message box showing the values that were tested. However, I do not know these values as they are passed through a function. I want to be able to show these values that were passed through the function as a string int he message box, however, since i can''t convert the numeral values to characters, i can''t add them to a string to print etc.
How would i convert them? is there some easy functiont hat will do it all for me? (:D)?
Thanks!!
Fuzztrek
¬_¬
You can use the itoa() function or what I do, just use sprintf() eg:
int val;
// do something
char errorstring[50];
sprintf(errorstring, "The value tested was %d", val);
cout << errorstring << endl;
very simple...
CEO Platoon Studios
int val;
// do something
char errorstring[50];
sprintf(errorstring, "The value tested was %d", val);
cout << errorstring << endl;
very simple...
CEO Platoon Studios
[email=esheppard@gmail.com]esheppard@gmail.com[/email]
September 07, 2002 08:35 PM
The itoa function is non-standard. Just use snprintf, or sprintf if you must, or stringstream in C++.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement