conversion from unsigned char* to const wchar_t*
问题 I am using the following code to convert a string from unsigned char* to const wchar_t* . The error I am getting is that only a few words are being converted properly while the rest is garbled value. CODE unsigned char* temp = fileUtils->getFileData("levels.json", "r", &size); const char* temp1 = reinterpret_cast<const char*>(temp); size_t len = mbstowcs(nullptr, &temp1[0], 0); if (len == -1) { } else { wchar_t* levelData = new wchar_t(); mbstowcs(&levelData[0], &temp1[0], size*10); } OUTPUT