[英]How to convert LPCSTR to WCHAR*?
How to convert LPCSTR to WCHAR* into a Unicode project, please ? 请如何将LPCSTR转换为WCHAR *成为Unicode项目? I haven't found much on the net.
我在网上找不到很多东西。
If you are NOT including AtlBase.h
or AtlConv.h
headers, 如果您不包括
AtlBase.h
或AtlConv.h
标头,
#include <windows.h>
LPCSTR lpcszTemp = "Hello World" ;
int wchars_num = MultiByteToWideChar( CP_UTF8 , 0 , lpcszTemp , -1, NULL , 0 );
WCHAR* wstr = new WCHAR[wchars_num];
MultiByteToWideChar( CP_UTF8 , 0 , lpcszTemp , -1, wstr , wchars_num );
// ...Other codes...
delete[] wstr;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.