end of file byte
I'm just wondering what this byte actually looks like. My textbook says that it's dependent on OS but often ctrl + Z.
Ok, fair enough. But as I see it, there are only 256 possible distinct values for a byte, and all are listed in a chart of ASCII codes, in which some of the ones 31 and lower are still mysterious to me.
But, if you want to interpret those bytes as numbers rather than characters, you can't exclude any of the possible 256 values. int, for example, needs all 256 possibililities if it's going to store its 4 billion plus possible values in 4 bytes of memory.
Do we actually need more than 4 bytes to store an arbitrary integer on disk so that there's available space to tell us when we've reached the end of the file?
Could someone explain the mechanics of this?
What I'm not seeing is how a file can at the same time leave all 256 options open for storing a numeric value in a byte and at the same time have some specific byte value that definitively signals the end of a file.
End-of-file bytes are used in systems that do not have exact file-lengths in the directory structure in the filesystem. DOS, Windows and Linux all have exact (to a single byte) length in stored in the filesystem.
PDP-11 RSTS/E or i8080 or Z80 CP/M would be examples of OS's that store "the number of blocks used by the file" rather than the number of bytes, so to show where the end of the actual data ends.
Since this only matters for text-files, it's fine to use certain bytes for indication purposes. Likewise, we have newlines, carriage returns, and another control characters to tell the output device to go to the next line, and such.
For binary files, such as data-files, jpeg's, do not use control characters for these purposes. So for these files, the special characters do not indicate for example end-of-file. For this purpose, we should use the "binary" modifier to tell the stream management that "do not treat control characters as special" - so you just read each byte for what it is, there is no special meaning to any of them - all values 0-255 are "valid data".