标签:byte amp std class resize logs style log wchar_t
#include <windows.h> #include <string> bool WcharToChar(const wchar_t* wp, std::string& str) { int len = WideCharToMultiByte(CP_ACP, 0, wp, wcslen(wp), NULL, 0, NULL, NULL); str.resize(len + 1); return WideCharToMultiByte(CP_ACP, 0, wp, wcslen(wp), (char*)str.data(), len, NULL, NULL) > 0; } bool CharToWchar(const char* c, std::wstring& wstr) { int len = MultiByteToWideChar(CP_ACP, 0, c, strlen(c), NULL, 0); wstr.resize(len + 1); return MultiByteToWideChar(CP_ACP, 0, c, strlen(c), (wchar_t*)wstr.data(), len) > 0; }
标签:byte amp std class resize logs style log wchar_t
原文地址:http://www.cnblogs.com/liuhan333/p/6691434.html