C++中将WCHAR字符串转换成CHAR字符串:
#include<comdef.h>//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;
}
三种方法都可以.