• 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
Variadic arguments & private log file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Variadic arguments & private log file


  • Subject: Variadic arguments & private log file
  • From: Brad Peterson <email@hidden>
  • Date: Wed, 6 Jul 2005 13:03:06 -0700 (PDT)

Hi all,

I know similar items have been discussed before, but I
couldn't find this particular variation in the
archives...

I'm trying to do a private log via a log object. No
problem there; I've got the variadic args compiling.

However, when I try to pass the args into NSString's
stringWithFormat, it crashes.

- ( void ) myLog: ( NSString * ) format, ... {
    va_list args;
    va_start(args, format);
	NSString *str = [ NSString stringWithFormat: format,
args ];
    va_end(args);
	[ log addObject: [ NSString stringWithFormat: @"%@ :
%@", [ NSCalendarDate date ], str ] ];
}

Certainly, if you swap in NSLogv, this works, so I'm
sure I'm missing something painfully obvious, but...
I'm still missing it.

Any thoughts would be greatly appreciated.

Thanks,

B

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
 _______________________________________________
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

  • Follow-Ups:
    • Re: Variadic arguments & private log file
      • From: Dave Hayden <email@hidden>
  • Prev by Date: Re: CoreData - calculations in tables?
  • Next by Date: Re: turning on the 'Open Recent' attribute for an NSMenuItem
  • Previous by thread: Re: using the text system to implement styles
  • Next by thread: Re: Variadic arguments & private log file
  • Index(es):
    • Date
    • Thread