open() in binary vs. text mode

Grant Edwards grante at visi.com
Fri Mar 21 16:38:07 EST 2003


In article <mailman.1048277318.19332.python-list at python.org>, Tim Peters wrote:

>> When in windows, reading in text mode, if it came across ASCII
>> character 26, it would quit and not read any more of the file.
>> This does not happen on other platforms or on windows when
>> reading in binary mode.
>>
>> Why would a specific character cause this behavior?
> 
> Backward compatibility with DOS 1.0, which didn't save the
> sizes of files in the system file directory.  They needed some
> other way to recognize the end of a file, and picked on Ctrl+Z
> (chr(26)) to mean EOF.  This is specific to CPM and DOS
> derivatives (like Windows), AFAIK.

Which means it's probably ultimately feature left over from a
DEC filesystem used by either RSX-11 or RSTS back in the days
of the PDP-11...

-- 
Grant Edwards                   grante             Yow!  I've got to get
                                  at               these SNACK CAKES to NEWARK
                               visi.com            by DAWN!!




More information about the Python-list mailing list