|
|
Message-ID: <20180202150132.tzocezrj5vskos66@voyager>
Date: Fri, 2 Feb 2018 16:01:32 +0100
From: Markus Wichmann <nullplan@....net>
To: musl@...ts.openwall.com
Subject: Re: Why are stdin/stdout/stderr `FILE *const` in musl?
On Fri, Feb 02, 2018 at 02:24:28PM +0100, CodingMarkus wrote:
> void * getOutputPtr ( void ) {
> if (/* whatever */) {
> return &stdout;
> }
> return &stderr;
> }
>
Why would you ever need a pointer to stdout or stderr? They are already
pointers to FILE. The right way to do this is
FILE *getOutputPtr (void) {
return intofile? fopen("log.txt", "w") : whatever? stdout: stderr;
}
Ciao,
Markus
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.