Re: Re: NSLog() and stderr
Re: Re: NSLog() and stderr
- Subject: Re: Re: NSLog() and stderr
- From: "Michael Ash" <email@hidden>
- Date: Sun, 2 Jul 2006 15:28:09 -0400
On 7/2/06, Frode <email@hidden> wrote:
void MyFLogv(FILE *fp, NSString *format, va_list argList) {
int old_fd = dup(fileno(stderr));
int new_fd = dup2(fileno(fp), fileno(stderr));
NSLogv(format, argList);
(void)dup2(old_fd, fileno(stderr));
}
Please, please do not do this. It's horrible and not thread safe.
Don't use NSLog at all, use NSString to build a string using the
format and argList, then write it out using fwrite or similar.
Mike
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden