Commit 0e453bf3cd07703b9bbea59289f9456274616308
Merge https://archives.plil.fr/wrudamet2/ima3_projet_pa_2019
Showing
3 changed files
with
29 additions
and
0 deletions
Show diff stats
@@ -0,0 +1,22 @@ | @@ -0,0 +1,22 @@ | ||
1 | +#include <stdio.h> | ||
2 | +#include <wchar.h> // library for wide-chars | ||
3 | +#include <locale.h> | ||
4 | + | ||
5 | +int main() { | ||
6 | + wchar_t c; | ||
7 | + | ||
8 | + FILE* f=fopen("accents.txt", "r"); | ||
9 | + setlocale(LC_ALL,""); // tell stdlib to convert chars to 4 bytes | ||
10 | + | ||
11 | + // Most stdio functions have wide-char counterparts | ||
12 | + // Try searching "wchar wiki" for info (I could not find a proper man page) | ||
13 | + while((c=fgetwc(f))!=WEOF) { | ||
14 | + putwchar(c); | ||
15 | + } | ||
16 | + | ||
17 | + // use L for wchar constants/strings | ||
18 | + // also, specifier for wchar in format string is %lc | ||
19 | + wprintf(L"\nAh à h%lc\n",L'â'); | ||
20 | + | ||
21 | + return 0; | ||
22 | +} |
@@ -0,0 +1 @@ | @@ -0,0 +1 @@ | ||
1 | +Salut uéé, y ê tu ? |