wchar_t* charToWchar(const char* src) { size_t size = strlen(src) + 1; wchar_t* dest = new wchar_t[size]; size_t outSize; mbstowcs_s(&outSize, dest, size, src, size - 1); return dest; }
string wstr2str(const wstring& wstr) { string str(wstr.length(), ' '); copy(wstr.begin(), wstr.end(), str.begin()); return str; }
标签:src,str,dest,c++,wstr,chat,wchar,size From: https://www.cnblogs.com/laremehpe/p/17721843.html