CString与TCHAR数组 相互转换

来源:互联网 发布:java mvc web项目实例 编辑:程序博客网 时间:2024/06/05 11:43

转载自: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);