CString TCHAR互相转换

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

// 原型:LPTSTR GetBuffer( int nMinBufLength );
CString str(_T("Michael Joessy"));
const TCHAR* pszMsg = str.GetBuffer(str.GetLength());
str.ReleaseBuffer();

注意:GetBuffer后一定记得ReleaseBuffer。

TCHAR*->CString的转化

TCHAR szTchar[20] = L"Michael Joessy";   
CString  str;   
str.Format(_T("%s"), szTchar);  
原文地址:https://www.cnblogs.com/MakeView660/p/6803099.html