1,int 转 CString :
int s = 123;
CString str;
str.Format(_T("%d"),s);
CString 转 int :
CString strl ;
int nIndex = _ttoi(str);
2,char *(或const char *) 转 CString
char *s = "char *";
CString str;
str.Format(_T("%s"),s);
CString 转 const char*
CString cstring;
const char * constChar=(LPCTSTR)cstring;
3,const char * 转 LPTSTR(LPCTSTR)
LPTSTR lptStr=new TCHAR[32];
TCHAR* szBuf=_T("Hello");
以上两个语句,无论是在ANSI编码方式,还是在Unicode编码方式下都是正确的。
4,CString 转 LPTSTR(LPCTSTR)
CString path1;
LPTSTR path2=path1.GetBuffer(path1.GetLenght());
//continue..