Mail Archives: djgpp/2009/04/04/22:17:41

X-Authentication-Warning: 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 <eliz AT gnu DOT org>
Subject: Re: setmode
In-reply-to: <gr8qm6$e8p$>
X-012-Sender: halo1 AT inter DOT net DOT il
To: djgpp AT delorie DOT com
Message-id: <>
References: <gr3fv1$s9f$1 AT aioe DOT org> <uk561j05t DOT fsf AT gnu DOT org> <gr72bt$tjk$1 AT aioe DOT org> <83ljqgdchw DOT fsf AT gnu DOT org> <gr7gu5$aou$1 AT aioe DOT org> <83bprccygw DOT fsf AT gnu DOT org> <gr8qm6$e8p$1 AT aioe 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

> From: "Rod Pemberton" <do_not_have AT nohavenot DOT cmm>
> Date: Sat, 4 Apr 2009 19:35:52 -0400
> "Eli Zaretskii" <eliz AT gnu DOT org> 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 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.

- Raw text -

  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019