+ 2

What is the ASCII value of eof?

3rd Aug 2017, 5:11 PM
Chandan Shetti
Chandan Shetti - avatar
3 Respuestas
+ 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.
3rd Aug 2017, 11:34 PM
Kirk Schafer
Kirk Schafer - avatar
+ 2
Thank you.
3rd Aug 2017, 5:28 PM
Chandan Shetti
Chandan Shetti - avatar
+ 2
depends on the compiler, generally it's -1
4th Aug 2017, 1:12 AM
Andrés04_ve
Andrés04_ve - avatar