OSDN Git Service

Reimplement mbrlen(), mbrtowc(), and mbsrtowcs() functions.
[mingw/mingw-org-wsl.git] / mingwrt / mingwex / btowc.c
1 #include "mb_wc_common.h"
2 #include <wchar.h>
3 #include <stdio.h>
4 #define WIN32_LEAN_AND_MEAN
5 #include <windows.h>
6
7 wint_t btowc (int c)
8 {
9   if (c == EOF)
10     return (WEOF);
11   else
12     {
13       unsigned char ch = c;
14       wchar_t wc = WEOF;
15       MultiByteToWideChar (get_codepage(), MB_ERR_INVALID_CHARS,
16                            (char*)&ch, 1, &wc, 1);
17       return wc;
18     }
19 }