-
Is there a away to turn a long to a string?
example:
long a, b, c;
CString strTemp;
a = 1;
b = 2;
c = a + b;
strTemp = c; (Heres the problem. This would just give me the coresponding ASCII char)
AfxMessageBox("1 + 1 =" + strTemp,NULL,NULL);
Any help?
Thanks
-
Assuming you've got <stdlib.h> included, this will do it I think:
Code:
_ltoa(c, &strTemp, 10);
Not sure if it will work with CString, here's the prototype for it anyway:
char *_ltoa( long value, char *string, int radix );
Parameters
value
Number to be converted
string
String result
radix
Base of value
-
I got that honestly about 5 seconds before my email dinged for new mail. I got it to work, thanks for your quick response though.
-