- #include <codecvt>
- #include <string>
- // convert UTF-8 string to wstring
- std::wstring utf8_to_wstring(const std::string& str)
- {
- std::wstring_convert<std::codecvt_utf8<wchar_t>> myconv;
- return myconv.from_bytes(str);
- }
- // convert wstring to UTF-8 string
- std::string wstring_to_utf8(const std::wstring& str)
- {
- std::wstring_convert<std::codecvt_utf8<wchar_t>> myconv;
- return myconv.to_bytes(str);
- }
rapidjson::Document doc;
if (doc.Parse<0>(response.c_str()).HasParseError()){return ;
}
rapidjson::Value & v = doc["msg"];
std::wstring_convert<std::codecvt_utf8<wchar_t>> myconv;
std::wstring msg=myconv.from_bytes(v.GetString());
OutputDebugPrintf(L"I'm %s years old.\n", msg );
void CLoginBiz::OutputDebugPrintf(LPCTSTR sFormat, ...)
{
TCHAR text[500 + 1];
memset(text, 0, 500 + 1);
va_list args;
va_start(args, sFormat);
int n = _vsntprintf(text, 500, sFormat, args);
va_end(args);
OutputDebugString(text);
if (n <= 0)
OutputDebugString(_T("[...]"));
}