file read, binary or text mode
Grant Edwards
grante at visi.com
Fri Sep 24 16:37:34 EDT 2004
On 2004-09-24, Peter Hansen <peter at engcorp.com> wrote:
> Good point. Note for the picky: it doesn't just get stripped... it
> *is* the last character, even if there's data following. Or to
> be blunt, ^Z (byte value 26) is treated as EOF on Windows when not
> using binary mode to read files.
<history>
That's because CP/M allocated file space in blocks and only
kept track of the length of the file in blocks. It was common
practice to mark the end of the "real" data in a text file with
a ^Z (IIRC, this was done by the application writing to the
file). Otherwise, you had no way of knowing _where_ in that
last block the data actually ended.
The original MS/PC-DOS was basically a CP/M clone.
I presume CP/M copied that behavior from RSX-11 or RT-11, but
that's just an educated guess.
</history>
--
Grant Edwards grante Yow! My mind is making
at ashtrays in Dayton...
visi.com
More information about the Python-list
mailing list