Re: printf
Re: printf
- Subject: Re: printf
- From: "Clark Cox" <email@hidden>
- Date: Thu, 13 Dec 2007 07:03:18 -0800
On Dec 13, 2007 6:40 AM, Roland Silver <email@hidden> wrote:
> Is there a function in one of the frameworks that's like printf, but
> allows the output conversion '%@' in its template? Eg
>
> likePrintf("%@ is allowable", @"this string");
> or better:
> likePrintf(@"%@ is allowable", @"this string");
No, but it's relatively easy to write your own:
int likePrintf(NSString *format, ...) {
va_list args;
va_start(args, format);
NSString *output = [[NSString alloc] initWithFormat: format
arguments: args];
va_end(args);
int result = printf("%s", [output UTF8String]);
[output release];
return result;
}
--
Clark S. Cox III
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
References: | |
| >printf (From: Roland Silver <email@hidden>) |