Convert ASCII string to Unicode? Windows, pure C

ascii, c, unicode, windows

Solution

`MultiByteToWideChar`:

#include <windows.h>
char *string = "The quick brown fox jumps over the lazy dog";
size_t len = strlen(string);
WCHAR unistring[len + 1];
int result = MultiByteToWideChar(CP_OEMCP, 0, string, -1, unistring, len + 1);

Problem

I've found answers to this question for many programming languages, except for C, using the Windows API. No C++ answers please. Consider the following: ``` #include <windows.h> char *string = "The quick brown fox jumps over the lazy dog"; WCHAR unistring[strlen(string)+1]; ``` What function can I use to fill unistring with the characters from string?

Original source

Related problems