• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Re: NSLog() and stderr
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Re: NSLog() and stderr (From: Frode <email@hidden>)

  • Prev by Date: Re: Automagically retained array
  • Next by Date: Slow apparition of the Open Dialog, solution?
  • Previous by thread: Re: NSLog() and stderr
  • Next by thread: Re: NSLog() and stderr
  • Index(es):
    • Date
    • Thread