At Friday 8/12/2006 02:23, John Machin wrote:
> > > ftxt=open(filename,"rt")
Why did you do that?
(1) Text mode is was and ever shall be the default, even with MS.
No, there used to be a flag in the stdio library, giving the
default value when neither t or b was specified.
For the Borland C++ 3.1 help (about 1991):
If "t" or "b" is not given in the string, the mode is governed by _fmode.
If _fmode is set to O_BINARY, files are opened in binary mode.
If _fmode is set to O_TEXT, they are opened in text mode.
MSC used to have a similar flag (perhaps using the same name).
Indeed, and their docs say that the default for _fmode is text mode.
But anyone could change that *global* flag, making "binary" the
default afterwards. So if you really wanted a text file you had to be explicit.
All of this predates wide usage of ANSI C 89, which made the "t"
flag obsolete.
(2) Seeing we're referring to docs and standards: Microsoft C 5.0
Optimizing Compiler, Run-Time Library Reference manual says "The t
option is not part of the ANSI standard for open, but is a Microsoft
extension and should not be used where ANSI portability is required".
A "t" after the initial recognized characters should be ignored by
any conforming compiler. I think the idea was to allow for
extensions like fopen(fn, "rt;reclen=128") but except esoteric
platforms I doubt anyone is using that.
So it should be ignored.
So, back to the question: why did you get into the habit of writing
"rt" when it was pointless?
Because it was *not* pointless before ANSI C.
--
Gabriel Genellina
Softlab SRL
__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar
--
http://mail.python.org/mailman/listinfo/python-list