std::string theString = "hello"; CComBSTR bstr(theString.c_str()); DoSomething(bstr); // ...
string str=_T("翔翔糖糖"); int size=MultiByteToWideChar(CP_ACP,0,str.c_str(),-1,NULL,0); wchar_t *ch=new wchar_t[size+1]; if(!MultiByteToWideChar(CP_ACP,0,str.c_str(),-1,ch,size)) { return false;} wstring wstr=ch; 2、char*转换为wchar_t*: char *str=_T("翔翔糖糖")...
std::string ws2s(const std::wstring& ws){ std::string curLocale = setlocale(LC_ALL, NULL); // curLocale = "C";setlocale(LC_ALL, "chs");const wchar_t* _Source = ws.c_str();size_t _Dsize = 2 * ws.size() + 1;char *_Dest = new char[_Dsize];memset(_Des...