C++中将WCHAR亨蚂擤缚字符串转换成CHAR字符串:
#include<comdef.h&g墉掠载牿t;//youwillneedthis
constWCHAR*wc=L"HelloWorld";
_bstr_tb(wc);
constchar*c=b;
printf("Output:%s\n",c);
扩展资料
char转wchar
constwchar_t*GetWC(constchar*c)
{
constsize_tcSize=strlen(c)+1;
wchar_t*wc=newwchar_t[cSize];
mbstowcs(wc,c,cSize);
returnwc;
}