CString与TCHAR数组 相互转换

转载自:http://blog.sina.com.cn/s/blog_673ccb5b0101412b.html


TCHAR数组转到CString很简单:使用CString的Format就行。

 TCHAR m_buf[100] = _T("Hello");
 CString str;
 str.Format(L"%s",m_buf);


CString转为TCHAR数组,使用_tcscpy()宏。

CString str = L"sssssss";
TCHAR m_buf[20];
_tcscpy(m_buf, str);




你可能感兴趣的:(【C++】)