1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
#include <wchar.h> #include <locale.h> #include <string.h> wint_t btowc(int c) { char *l = setlocale(LC_CTYPE, NULL); if (!strcmp(l, "C") || !strcmp(l, "POSIX")) { if (c <= 127) { return (unsigned char)c; } } /* conversion */ return WEOF; } /* STDC(199409) */