diff --git a/accents.c b/accents.c new file mode 100644 index 0000000..7b1a96b --- /dev/null +++ b/accents.c @@ -0,0 +1,22 @@ +#include +#include // library for wide-chars +#include + +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; +} diff --git a/accents.txt b/accents.txt new file mode 100644 index 0000000..94b6c60 --- /dev/null +++ b/accents.txt @@ -0,0 +1 @@ +Salut uéé, y ê tu ? -- libgit2 0.21.2