On 2:59 PM, Lawrence D'Oliveiro wrote:
In message<mailman.1504.1286659111.29448.python-l...@python.org>, Dennis
Lee Bieber wrote:

On Windows, the I/O system for text files converts<cr><lf>  into a
<lf>  on input, and on output converts<lf>  to<cr><lf>.
Is it Windows doing that, or is it some Visual Studio library?

Windows OS itself does not transform any newlines at all.

However, each version of Windows includes several versions of the Visual Studio runtime dll's, and applications which use those libraries may *think* the extra transformations those libraries do is part of Windows itself.

For example, in my XP system I see msvcrt.dll, msvcrt20.dll, and msvcrt40.dll in the c:\windows\system32 directory. These are part of various releases of Visual Studio (or of the C compiler in it). There are many other such dll's, but I'm concentrating on the one containing open(), and write(), etc.

The open() call is in Visual Studio's dll, while the CreateFileA is in Windows itself. The latter does no transformation, and nothing stops Python from calling that directly. However, except for the "t" versus "b", the open() call more closely matches the Unix convention.

The rest is convention. Many applications included with Windows create text files with the 0d0a convention, and expect files and streams to follow that convention. That includes CMD.exe, Notepad, etc. If you don't use any of these, Windows wouldn't care if you always used 0a for a line separator.

DaveA


--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to