{{keywords>wiki library source code example reference}} ===== fgetwc ===== #include wint_t fgetwc(FILE *); ==== fgetwc Description ==== fgetwc reads in a single character from Stream and returns its value as a wide character. ===== C Sourcecode Example ===== /* * fgetwc example code * http://code-reference.com/c/wchar.h/fgetwc */ #include /* including standard library */ //#include /* uncomment this for Windows */ #include int main( void ) { FILE* stream = fopen("testmb.txt", "r"); if (!stream) { printf("Could not open the file\n"); return 1; } wchar_t wchar = fgetwc(stream); if (wchar != WEOF) { printf("char read: %c\n", wchar); } else { printf("read error\n"); } fclose(stream); return 0; } === content of testmb.txt === A B C ==== output ==== A