[Python-Dev] Next version of PEP278 - universal newline support - available

Paul Svensson paul@svensson.org
Thu, 14 Mar 2002 09:12:40 -0500 (EST)


On Thu, 14 Mar 2002, Fredrik Lundh wrote:

>on a Unix box, does the following piece of code
>open a text file or a binary data file?
>
>    f = open(filename)

According to `man fopen` on Rock Linux 3.0.9, "r" is used for opening a text
file for reading, and "b" can be added, but has no effect.  So it appears
that at least on this variant of Unix, stdio can not read binary files... 

On the other hand, ANSI C specifies that "b" should be used when opening
binary files, so I suppose there would be some flags to the compiler to
make that work (gcc 2.95.2)...

Btw, does compiling Python require ANSI C, or does it work with an old K&R
style compiler as well ?  I'd love to have Python on my ITS box ;)

sidetracked-and-forgot-to-answer-the-question-ly,

	/Paul