Re: using printf to print objects
Re: using printf to print objects
- Subject: Re: using printf to print objects
- From: Gwynne <email@hidden>
- Date: Fri, 22 Oct 2004 14:21:02 -0400
On Oct 22, 2004, at 2:13 PM, Glenn Andreas wrote:
Depending on the level of verbosity you want from objects such as
NSDictionary:
printf( "%s", [someObject description] );
or
printf( "%s", [someObject debugDescription] );
The latter is what NSLog() does when it sees %@.
This will most likely crash, since %s excepts c-strings, and
description and debugDescription are both NSStrings.
Instead, something like
printf( "%s", [[someObject description] UTF8String] )
Ack! Sorry, you're right. Thanks for the correction, Glenn :).
-- Gwynne, key to the Code that runs us all
Email: email@hidden
Web:
http://musicimage.plasticchicken.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