Re: Variadic arguments & private log file
Re: Variadic arguments & private log file
- Subject: Re: Variadic arguments & private log file
- From: Brad Peterson <email@hidden>
- Date: Wed, 6 Jul 2005 14:57:31 -0700 (PDT)
Thank you. :)
--- Dave Hayden <email@hidden> wrote:
> On Jul 6, 2005, at 1:03 PM, Brad Peterson wrote:
>
> > 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 ] ];
> > }
>
> There's a handy NSString initializer for this case:
>
> - (id)initWithFormat:(NSString *)format
> arguments:(va_list)argList;
>
> -D
>
>
__________________________________________________
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