merre
April 22nd, 1999, 06:07 AM
Hi!
do everyone know how you can change int to CString or char* to CString
thx
do everyone know how you can change int to CString or char* to CString
thx
|
Click to See Complete Forum and Search --> : int to CString merre April 22nd, 1999, 06:07 AM Hi! do everyone know how you can change int to CString or char* to CString thx Satadal April 22nd, 1999, 06:24 AM It's very simple. The code snippet is below: CString myString; int nValue = 10; myString.Format("%d", nValue); //myString //contains 10 now. Similarly u can use %s, %c etc to format string, char to (CString similar to printf() in C) There is one more useful member function in CString named FormatMessage(). It is a bit difficult to use compared to format but xtremely helpful. Check it out :o) SatB eric33 April 22nd, 1999, 06:24 AM //int to CString (use Format method) int i=1; CString string; string.Format("%d",i); // Result : "1" // char* to CString (use operator =) CString string; char *source="try_this"; string=(LPCSTR)source; // Result : "try_this"; codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |