accents.c
549 Bytes
#include <stdio.h>
#include <wchar.h> // library for wide-chars
#include <locale.h>
int main() {
wchar_t c;
FILE* f=fopen("accents.txt", "r");
setlocale(LC_ALL,""); // tell stdlib to convert chars to 4 bytes
// Most stdio functions have wide-char counterparts
// Try searching "wchar wiki" for info (I could not find a proper man page)
while((c=fgetwc(f))!=WEOF) {
putwchar(c);
}
// use L for wchar constants/strings
// also, specifier for wchar in format string is %lc
wprintf(L"\nAh à h%lc\n",L'â');
return 0;
}