• 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: using printf to print objects
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: using printf to print objects


  • Subject: Re: using printf to print objects
  • From: Glenn Andreas <email@hidden>
  • Date: Fri, 22 Oct 2004 13:13:53 -0500

At 12:38 PM -0400 10/22/04, Gwynne wrote:
On Oct 22, 2004, at 12:30 PM, mail4 wrote:
I like NSLog, yet I find it too verbose.

I would like to use printf for objects.


Any Suggestions

p.s. I am primarily a command line programmer, thus I the app-kit outputs do not suit me

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] )


--
Glenn Andreas email@hidden <http://www.gandreas.com/> oh my!
Mad, Bad, and Dangerous to Know
_______________________________________________
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
  • Follow-Ups:
    • Re: using printf to print objects
      • From: Eric Ocean <email@hidden>
    • Re: using printf to print objects
      • From: Gwynne <email@hidden>
References: 
 >using printf to print objects (From: mail4 <email@hidden>)
 >Re: using printf to print objects (From: Gwynne <email@hidden>)

  • Prev by Date: Re: Toolbar Item Validation in a Panel
  • Next by Date: Re: Toolbar Item Validation in a Panel
  • Previous by thread: Re: using printf to print objects
  • Next by thread: Re: using printf to print objects
  • Index(es):
    • Date
    • Thread