
EOF Is Not a Character - rspivak
https://ruslanspivak.com/eofnotchar/
======
schoen
To complicate things, DOS has an EOF character (ASCII 26, ^Z), which is used
by _some_ text file reading and writing routines to indicate the end of a text
file. (Confusingly, other routines might behave more like the Unix behavior
described in this article.)

Also, Unix terminal drivers commonly treat the EOT (end-of-transmission, ASCII
4, ^D) character specially and _generate_ an EOF condition in response to a
user input containing EOT. This creates an especially challenging situation
for beginners to understand because, while EOF is not a character, there is a
character at another layer that sometimes causes an EOF condition—yet that
character itself is neither EOF, nor equivalent to EOF, nor guaranteed to
cause EOF in every circumstance. (Also, the EOT character's behavior in this
regard can be changed with the stty command, and it can be input as an
ordinary character from a terminal by first escaping it with ^V...)

