There was an EOF marker in early versions of MS-DOS.
Sort of. MS-DOS started by following many of the conventions of
CP/M, and in CP/M, a file always had a length which was a
multiple of 128 bytes. Which isn't always very convenient, so
different conventions were established. One was that a byte
with the value of 0x1A (^Z) would be considered the end of a
text file. Or that binary files had an internal structure, with
length fields, which allowed the reader to determine where they
ended.
If you read carefully the guarantees that C (and indirectly C++)
gives for text and binary files, you'll see some loopholes which
are obviously designed to allow an implementation on this OS:
when you reread a file written binary, you may read additional
bytes at the end, for example. (Other loopholes were designed
to allow text files with fixed length records.)
I don't know if any operating system code crashed if an attempt
was made to read beyond the EOF marker in the file, but there
were some user programs that expected to find a ^Z and crashed
if it wasn't found. Naturally, they would also put it back
when saving the file.
The OS wouldn't let you read past end of file, period. Whether
CP/M or MS-DOS. The problem in CP/M was that end of file could
only be at an exact multiple of 128 bytes. MS-DOS didn't have
this problem, and there was never any real need for an EOF
character in MS-DOS, but many of the earliest applications were
direct ports of CP/M programs, which in fact always did write
multiples of 128 bytes, and expected the 0x1A.
Even today, most Windows implementations of C++ will stop
reading a text file if they encounter a 0x1A in it. (I'm not
sure how this works if you attempt to seek to the end.)
Possible a remant from the time when files may have been stored
on a tape device without any bookkeeping, hence impossible to
know in advance how long the file is, without an EOF marker.
No. The EOF marker on tape wouldn't affect much; it's just an
EOF.
I would be surprised if the C++ standard did not allow such
implementation of text files.
It does.