X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f X-Recipient: djgpp AT delorie DOT com Date: Sun, 05 Apr 2009 06:15:25 +0300 From: Eli Zaretskii Subject: Re: setmode In-reply-to: X-012-Sender: halo1 AT inter DOT net DOT il To: djgpp AT delorie DOT com Message-id: <83zlevbxki.fsf@gnu.org> References: <83ljqgdchw DOT fsf AT gnu DOT org> <83bprccygw DOT fsf AT gnu DOT org> Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > From: "Rod Pemberton" > Date: Sat, 4 Apr 2009 19:35:52 -0400 > > "Eli Zaretskii" wrote in message > news:83bprccygw DOT fsf AT gnu DOT org... > > > freopen() is supposed to implement all functionality of fopen(), which > > > includes opening the redirected-to-file as binary. > > > > And it does, as long as you know the name of that file. > > > > Then, what is DJGPP's filename to use for stdout as the first parameter of > freopen()? There is none, sorry. > After looking at the spec., I'm asking how to go about using freopen() to do > what is mentioned in ISO C 7.19.5.4 sub 3: > > "If filename is a NULL pointer, the freopen function attempts to change the > mode of the stream to that specified by mode, as if the name of the file > currently associated with the stream had been used. It is > implementation-defined which changes of mode are permitted (if any), and > under what circumstances." This requirement is new with C99, it wasn't there in C89. DJGPP does not fully support C99 yet, not even with (the unreleased) v2.04. Patches are welcome, of course. > How do I change the mode of stdout to binary, just as in the setmode call, > by using freopen()?... NULL doesn't work. Is this functionality > implemented? No. NULL is invalid value for that argument, as C89 says, and DJGPP's implementation fails when you do that.