65.9K
CodeProject 正在变化。 阅读更多。
Home

C++ 中将 ASCII 字符串转换为 Unicode

emptyStarIconemptyStarIconemptyStarIconemptyStarIconemptyStarIcon

0/5 (0投票)

2011 年 5 月 13 日

CPOL
viewsIcon

10500

另外,由于 _bstr_t 具有 (char *) 和 (wchar_t *) 运算符,如果你包含了 comutil.h,你可以使用它来进行转换。char * source = "this is my source" ;_bstr_t converter_temp(source) ;wstring target ;target = wstring(converter_temp) ;... 以及反过来...

另外,由于 _bstr_t 具有 (char *) 和 (wchar_t *) 运算符,如果你包含了 comutil.h,你可以使用它来进行转换。
char * source = "this is my source" ;
_bstr_t converter_temp(source) ;
wstring target ;
target = wstring(converter_temp) ;
... 以及反过来 ...
std:string back_To_Mbcs = (char *) _bstr_t(target.c_str()) ;
我不会在循环中执行此操作,因为我们不知道 _bstr_t 实现是否在幕后使用了 A2W()。
© . All rights reserved.