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);  

 

posted on 2017-05-03 17:46  我来乔23  阅读(1074)  评论(0编辑  收藏  举报

导航