网站首页 美食营养 游戏数码 手工爱好 生活家居 健康养生 运动户外 职场理财 情感交际 母婴教育 时尚美容

C++中怎么将WCHAR字符串转换成CHAR字符串

时间:2024-10-13 22:56:33

C++中将WCHAR亨蚂擤缚字符串转换成CHAR字符串:

#include<comdef.h>//youwillneedthis

constWCHAR*wc=L"HelloWorld";

_bstr_tb(wc);

constchar*c=b;

printf("Output:%s\n",c);

C++中怎么将WCHAR字符串转换成CHAR字符串

扩展资料

char转wchar

constwchar_t*GetWC(constchar*c)

{

constsize_tcSize=strlen(c)+1;

wchar_t*wc=newwchar_t[cSize];

mbstowcs(wc,c,cSize);

returnwc;

}

© 2025 五度知识库
信息来自网络 所有数据仅供参考
有疑问请联系站长 site.kefu@gmail.com