Is there really an EOF?

When I use file functions in PHP, I check EOF. I wonder if EOF really exists in the file. When I create an empty text file, it displays 0K. How does EOF exist in a 0K file?

+3
source share
3 answers

There is a character to control the end of the file (in the ASCII character its CTRL + Z or 26 or 0x1A is specified), but in fact it is not needed to indicate the end of the file, since OSes released in the 80s, All modern OSs store the file size as metadata in the directory structure (the exact format depends on the file system), and high-level file access functions will check the file size to determine when to tell EOF to you, the programmer.

, ( , NL ↔ CRLF), EOF. , .

+9

EOF. , 4 1 , .

+1

it does not exist .. but the file size does, and that you know where eof is

0
source

Source: https://habr.com/ru/post/1736033/


All Articles