123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- #include <sys/limits.h>
- #include <stdio.h>
- #include <string.h>
- #include <wchar.h>
- wint_t btowc(int c)
- {
- mbstate_t mbs;
- char cc;
- wchar_t wc;
-
- if (c < 0 || c > SCHAR_MAX || c == EOF)
- return (WEOF);
-
- memset(&mbs, 0, sizeof(mbs));
- cc = (char)c;
- if (mbrtowc(&wc, &cc, 1, &mbs) > 1)
- return (WEOF);
- return (wc);
- }
|