S
Steven D'Aprano
tOn Sat, 18 May 2013 08:49:55 +0100, Fábio Santos
<[email protected]> declaimed the following in
gmane.comp.python.general:
Windows certainly may mess with what you write to your file, if it is
opened in Text mode instead of Binary mode. In text mode, Windows will:
- interpret Ctrl-Z characters as End Of File when reading;
- convert \r\n to \n when reading;
- convert \n to \r\n when writing.
http://msdn.microsoft.com/en-us/library/z5hh6ee9(v=vs.80).aspx
Neither... It goes back to Teletype machines where one sent a
carriage return to move the printhead back to the left, then sent a line
feed to advance the paper (while the head was still moving left), and in
some cases also provided a rub-out character (a do-nothing) to add an
additional character time delay.
Yes, if you go back far enough, you get to teletype machines. But Windows
inherits its text-mode behaviour from DOS, which inherits it from CP/M.
TRS-80 Mod 1-4 used <cr> for "new line", I believe Apple used <lf>
for "new line"...
I can't comment about TRS, but classic Apple Macs (up to System 9) used
carriage return \r as the line separator.