+ 2
What is the ASCII value of eof?
3 Answers
+ 4
This is lost knowledge territory, in the sense that the references I was reading seem to be confusing the ASCII character and the EOF constant / status flag.
The EOF constant is a flag that indicates you can not read any more.
There is no point in reading after the flag is sent.
The ASCII character code for "eof" is 26 (Ctrl-Z). It has special text file meaning.
While not a hard limit (and you can still read) text modes will truncate at that character.
This code demonstrates ASCII 26 truncating a text-mode read:
https://code.sololearn.com/cyt3z1m2z69Q/?ref=app
It's not just buffered reads; some codes using readln will also inexplicably stop short if someone gets ASCII 26 in a text-mode file.
+ 2
Thank you.
+ 2
depends on the compiler, generally it's -1