Re: NSLog and va_list
Re: NSLog and va_list
- Subject: Re: NSLog and va_list
- From: Alexander Spohr <email@hidden>
- Date: Thu, 17 Jun 2010 14:37:31 +0200
What exactly so you want?
Either you have an va_list and want to give it to NSLog? Then use
void NSLogv(NSString *format, va_list args);
But I think you want to know what the va_list contains.
Then you just loop over it.
"man stdarg" will help.
Example:
void foo(char *fmt, ...)
{
va_list ap;
int d;
char c, *p, *s;
va_start(ap, fmt);
while (*fmt)
switch(*fmt++) {
case 's': /* string */
s = va_arg(ap, char *);
printf("string %s\n", s);
break;
case 'd': /* int */
d = va_arg(ap, int);
printf("int %d\n", d);
break;
case 'c': /* char */
c = va_arg(ap, char);
printf("char %c\n", c);
break;
}
va_end(ap);
}
Have a nice day,
atze
Am 17.06.2010 um 14:21 schrieb Matt James:
> Hi everyone,
>
> Can anyone tell me how to NSLog() a va_list variable so I can see what's in it?
>
> Thanks for the help!
>
> -Matt_______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden