Click to See Complete Forum and Search --> : integer 2 CString ???


August 30th, 1999, 07:16 PM
hi
how do I convert an number stored in integer format to a CString? I need this to print Text using the CDC.TextOut function. Or is there another way to do this, e.g a TextOut that handles integers too? It certainly doesn´t work if i just put the Integer variable instead of the CString in TextOut().
please give me some advice

Rail Jon Rogut
August 30th, 1999, 07:30 PM
int iValue = 125;

CString szValue;

szValue.Format("%d", iValue); // Look up help for printf

Now use the CString object in your call to TextOut().

Rail

------------
Recording Engineer/Software Developer
Rail Jon Rogut Software
http://home.earthlink.net/~railro/
railro@earthlink.net

jdala
August 30th, 1999, 07:31 PM
Hello,

Try this one :

int nNum = 10; // an int for ex.
CString str;
str.Format( "%d",nNum );
// you have now str = "10";




YEOJ