• 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: NSLog and va_list
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: NSLog and va_list
      • From: Bill Bumgarner <email@hidden>
References: 
 >NSLog and va_list (From: Matt James <email@hidden>)

  • Prev by Date: Re: NSLog and va_list
  • Next by Date: Invitation to connect on LinkedIn
  • Previous by thread: Re: NSLog and va_list
  • Next by thread: Re: NSLog and va_list
  • Index(es):
    • Date
    • Thread