char to wchar_t conversion
-
I have tried to lookup a conversion of a char to wchar_t, only found the other way around. //my code WCHAR* FileType; char buffer[512]; ifstream inn; inn.open("SkyWorld.ini"); string buffer1; getline(inn, buffer1); sprintf(buffer, "%s", buffer1.c_str()); // now buffer to FileType, or if possible, string to wchar_t so i can save 1 stepp. thanks
-
I have tried to lookup a conversion of a char to wchar_t, only found the other way around. //my code WCHAR* FileType; char buffer[512]; ifstream inn; inn.open("SkyWorld.ini"); string buffer1; getline(inn, buffer1); sprintf(buffer, "%s", buffer1.c_str()); // now buffer to FileType, or if possible, string to wchar_t so i can save 1 stepp. thanks
FileType = new WCHAR[strlen(buffer) + 1]; MultiByteToWideChar(CP_ACP, 0, buffer, -1, FileType, strlen(buffer) + 1); Mark
-
FileType = new WCHAR[strlen(buffer) + 1]; MultiByteToWideChar(CP_ACP, 0, buffer, -1, FileType, strlen(buffer) + 1); Mark
worked like a charm , thanks