Skip navigation.
 
mlRe: Re: NSLog() and stderr
FROM : Michael Ash
DATE : Sun Jul 02 21:28:09 2006

On 7/2/06, Frode <<email_removed>> 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

Related mailsAuthorDate
mlNSLog() and stderr Damien Sorresso Jul 1, 03:09
mlRe: NSLog() and stderr Chris Suter Jul 1, 04:12
mlRe: NSLog() and stderr Frode Jul 2, 10:51
mlRe: Re: NSLog() and stderr Michael Ash Jul 2, 21:28
mlRe: NSLog() and stderr Aleksandr Skobelev Jul 3, 12:06