bug in freopen

Eric Blake ebb9@byu.net
Mon Jan 9 19:58:00 GMT 2006


Dave Korn <dave.korn <at> artimi.com> wrote in
http://cygwin.com/ml/cygwin/2005-07/msg00725.html:

> >Sent: 15 July 2005 00:14
> 
> > POSIX requires that freopen(NULL, mode, f) reopen f in the new
> > mode, and allows implementations the option of not even closing
> > f in the first place.
> 
>   I could take a look at this over the weekend if nobody gets to it first :)

Some closure to this old thread - I beat DaveK to the patch, and Jeff just 
installed it into newlib.  So the next snapshot should support freopen
(NULL, "rb", stdin) as a handy way to force stdin into binary mode.  It should 
even be safe when stdin is a tty (you really don't want to be switching ttys 
between binary and text modes, but freopen will take care of that).

--
Eric Blake





More information about the Newlib mailing list