This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: bug in freopen
- From: Eric Blake <ebb9 at byu dot net>
- To: newlib at sources dot redhat dot com
- Date: Mon, 9 Jan 2006 19:20:22 +0000 (UTC)
- Subject: Re: bug in freopen
- References: <071420052313.28844.42D6F19F0007DD6E000070AC22007340760A050E040D0C079D0A@comcast.net> <SERRANOE4bAkX9cC02Q0000057b@SERRANO.CAM.ARTIMI.COM>
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