MCPcopy Create free account
hub / github.com/atraczyk/2d-engine / convertCharArrayToLPCWSTR

Function convertCharArrayToLPCWSTR

engine/src/utils.cpp:56–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54}
55
56wchar_t *convertCharArrayToLPCWSTR(const char *charArray) {
57 size_t length = std::mbstowcs(nullptr, charArray, 0);
58 if (length == static_cast<size_t>(-1)) {
59 wchar_t *fallback = new wchar_t[1];
60 fallback[0] = L'\0';
61 return fallback;
62 }
63
64 wchar_t *wString = new wchar_t[length + 1];
65 std::mbstowcs(wString, charArray, length + 1);
66 return wString;
67}
68
69static bool fileExists(const std::string &path) {
70 std::ifstream file(path.c_str(), std::ios::binary);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected