|
-
April 22nd, 1999, 06:07 AM
#1
int to CString
Hi!
do everyone know how you can change int to CString or char* to CString
thx
-
April 22nd, 1999, 06:24 AM
#2
Re: int to CString
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 )
SatB
-
April 22nd, 1999, 06:24 AM
#3
Re: int to CString
//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";
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|