PDA

Click to See Complete Forum and Search --> : Data types conversions


jesper
Nov 11th, 2000, 02:43 AM
How can i convert from (for example) long to char ?
For example: i use api, which returned long value. How can i this value view in MessageBox function ?

Vlatko
Nov 11th, 2000, 07:19 AM
To convert the long value to char and display it in
a message box use this code:

long l = 250;
char *c = new char;
MessageBox(hWnd,itoa(l,c,10),"Caption",MB_OK);

parksie
Nov 11th, 2000, 07:47 AM
You need to have a proper buffer to avoid possible problems:

long l = 250;
char c[30];
MessageBox(hWnd,ltoa(l,c,10),"Caption",MB_OK);