X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: "Rod Pemberton" Newsgroups: comp.os.msdos.djgpp Subject: Re: setmode Date: Sat, 4 Apr 2009 19:35:52 -0400 Organization: Aioe.org NNTP Server Lines: 56 Message-ID: References: <83ljqgdchw DOT fsf AT gnu DOT org> <83bprccygw DOT fsf AT gnu DOT org> NNTP-Posting-Host: pldq+kT97bAAp/ObDwnZyQ.user.aioe.org X-Complaints-To: abuse AT aioe DOT org NNTP-Posting-Date: Sat, 4 Apr 2009 23:32:22 +0000 (UTC) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1933 X-Notice: Filtered by postfilter v. 0.7.7 X-Newsreader: Microsoft Outlook Express 6.00.2800.1933 Cancel-Lock: sha1:cAuJuVECkanwRpm3kkUy76ZlkZk= X-Priority: 3 X-MSMail-Priority: Normal To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com "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()? NULL? I tried that too. It failed. It continued to output to stdout in text mode. 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." 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? Previously, > > First, is there an equivalent to this in ANSI C? > > No. ANSI C says that everything about stdin and stdout is > implementation-defined, IIRC. I think the correct answer to that question is: Yes. ANSI C specifies an equivalent. The ANSI C equivalent is to use NULL as the first parameter to freopen(). Sub 3 says freopen() is _required_ to *attempt* to change the mode regardless of whether it is supported or not. Which modes are actually *permitted* by an implementation are implementation-defined. I already know that it seems that it isn't implemented. It is implemented somehow, by some method, using freopen() that I'm not recognizing? Given that the setmode() to binary for stdout for works for DJGPP, I don't understand why this wouldn't be implemented as part of freopen() too since it is mentioned in the spec.... Rod Pemberton