char * 转 LPWSTR

来源:互联网 发布:轿子知乎 编辑:程序博客网 时间:2024/05/21 16:06
 

在stdafx.h中包含如下头文件:

#include <atlbase.h>

在函数体中添加以下测试例程:

USES_CONVERSION;
char p[2];
p[0]=0xc4;
p[1]=0xe3;//显示中文字"你"

  LPWSTR pszText = A2W(p);
CString myStr;
myStr.Format(_T("%s"),pszText);
MessageBox(myStr);