master
 1/**
 2 * This file has no copyright assigned and is placed in the Public Domain.
 3 * This file is part of the mingw-w64 runtime package.
 4 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
 5 */
 6#ifndef WIN32_LEAN_AND_MEAN
 7#define WIN32_LEAN_AND_MEAN
 8#endif
 9#include "mb_wc_common.h"
10#include <wchar.h>
11#include <stdio.h>
12#include <windows.h>
13
14wint_t btowc (int c)
15{
16  if (c == EOF)
17    return (WEOF);
18  else
19    {
20      unsigned char ch = c;
21      wchar_t wc = WEOF;
22      if (!MultiByteToWideChar (___lc_codepage_func(), MB_ERR_INVALID_CHARS,
23                                (char*)&ch, 1, &wc, 1))
24        return WEOF;
25
26      return wc;
27    }
28}