#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;
}