a Foo walks into a bar...
Highlights
- Pro
Pinned Loading
-
-
-
-
Encoding conversion in C++
Encoding conversion in C++ 1// Convert a wide Unicode string to an ANSI string.
2std::string unicodeToAnsi(const std::wstring &wstr) {
3int bufSize = WideCharToMultiByte(CP_ACP, 0, &wstr[0], -1, NULL, 0, NULL, NULL);
4std::string strTo(bufSize, 0);
5WideCharToMultiByte(CP_ACP, 0, &wstr[0], (int)wstr.size(), &strTo[0], bufSize, NULL, NULL);
Something went wrong, please refresh the page to try again.
If the problem persists, check the GitHub status page or contact support.
If the problem persists, check the GitHub status page or contact support.