宽字符字符串转多字节字符串
| 62 | |
| 63 | // 宽字符字符串转多字节字符串 |
| 64 | std::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 | // 多字节字符串转宽字符字符串 |
| 78 | std::wstring StringToWString(const std::string& str) |
no test coverage detected