CString TCHAR的互相转换

CString>TCHAR*的转化可以用函数GetBuff()

函数原型为:LPTSTR GetBuffer( int nMinBufLength );
CString str("CString");
 TCHAR* szMsg = new TCHAR[100];
 //其参数为CString字符串的长度
 szMsg = str.GetBuffer(str.GetLength());
 str.ReleaseBuffer();
 delete []szMsg;
 szMsg = NULL;

TCHAR*>CString的转化

TCHAR szTchar[18] = L"TCHAR";   
 CString  str;   
 str.Format(_T("%s"),szTchar);  

posted on 2015-01-28 21:50  friend_joey  阅读(1337)  评论(0编辑  收藏  举报