C++中怎么将WCHAR字符串转换成CHAR字符串
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;
}
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:87
阅读量:63
阅读量:76
阅读量:90
阅读量:75