C++ 中将 ASCII 字符串转换为 Unicode
另外,由于 _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()。