Re: Variable argument methods
Re: Variable argument methods
- Subject: Re: Variable argument methods
- From: Andrew Pinski <email@hidden>
- Date: Thu, 10 Jul 2003 19:31:53 -0400
I would read a C book about var-args, it is the same in C as it is in
Objective-C.
Thanks,
Andrew Pinski
On Thursday, Jul 10, 2003, at 19:24 US/Eastern, Matt Diephouse wrote:
Hi. I'm new to Cocoa and Objective-C. I've only done programming in
Perl, Ruby, and Python before.
I'm trying to write a method that takes a variable number of
arguments. I've searched the archives and the net for examples, but
haven't understood anything I've come up with. I want to take the
following method (which is untested) and make so I'm not using an
array to pass arguments.
- (BOOL)sendCommand: (NSString *)cmd
withArgs: (NSArray *)args;
Here's an example of how I want its usage to look.
[class sendCommand:@"article"
withArgs:@"one", @"two", @"three"];
I think I need to use va_list and and associated functions, but I'm
not sure how they work. I've also seen it mentioned that two methods
are actually needed. Could someone please explain this for me? Please
keep in mind that I'm not used to dealing with types this way, having
come from a predominantly Perl background. Thanks,
matt
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.