[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Gnulib's freopen replacement and MinGW

From: Bruno Haible
Subject: Re: Gnulib's freopen replacement and MinGW
Date: Mon, 07 May 2012 20:11:54 +0200
User-agent: KMail/4.7.4 (Linux/3.1.10-1.9-desktop; KDE/4.7.4; x86_64; ; )

Eric Blake wrote:
> POSIX says that such a call is implementation-defined, so technically,
> mingw DOES implement the POSIX semantics (by defining that it is
> unsupported).

Yes. So, code in freopen.c that would try to support a NULL argument
in all cases
  - would be a gnulib extension,
  - would not be usable to change the read vs. write vs. append mode,
    because on many systems we would need to fiddle with FILE internals,
    which is hard and not reliable,
  - would be only useful to change the text vs. binary mode. But for this
    purpose gnulib already offers a simpler API: binary-io.h.

> However, you are correct that it is annoying, and
> something that gnulib could work around for easier coding.

I don't agree. It's not easier coding to write
  xfreopen (NULL, "rb", fp);
instead of
  SET_BINARY (fileno (fp));


reply via email to

[Prev in Thread] Current Thread [Next in Thread]