I used _setmode(_fileno(stdout), _O_U8TEXT)
.
I am trying to understand how wprintf()
differs from printf()
, so I am trying to understand the difference betweem putc()
and fputwc()
. I thought the difference was that fputwc()
could write 1–2 bytes and putc()
only one byte. This was the case when using them to write one byte long characters to a file, but when I use them to write to stdout, they were different.
The letter L'é'
is equivalent to 233, which is one byte long. So I thought that using putc(233, stdout)
would work as fputwc(233, stdout)
, but it does not: only fputwc(233, stdout)
works, even though both work equally when using them to write to a file. The other command wrote nothing.
Hence my question: how does the (Windows) terminal know if I wrote a wide character or a normal character?