MCPcopy Create free account
hub / github.com/aixed/WeChat-Hook / WStringToString

Function WStringToString

src/tools.cpp:64–75  ·  view source on GitHub ↗

宽字符字符串转多字节字符串

Source from the content-addressed store, hash-verified

62
63// 宽字符字符串转多字节字符串
64std::string WStringToString(const std::wstring& wstr)
65{
66 if (wstr.empty())
67 return "";
68
69 int size_needed = WideCharToMultiByte(CP_ACP, 0, &wstr[0], (int)wstr.size(),
70 NULL, 0, NULL, NULL);
71 std::string strTo(size_needed, 0);
72 WideCharToMultiByte(CP_ACP, 0, &wstr[0], (int)wstr.size(),
73 &strTo[0], size_needed, NULL, NULL);
74 return strTo;
75}
76
77// 多字节字符串转宽字符字符串
78std::wstring StringToWString(const std::string& str)

Callers 1

GetCmdLineFunction · 0.85

Calls 2

emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected