FROM : Dirk Stegemann
DATE : Fri Aug 11 18:47:39 2006
Hi,
Am 11.08.2006 um 19:26 schrieb Roland Silver:
> That takes care of the example I gave, but not the general case
> where one wants a format that includes "%@".
As far as I know, when passing an object reference to NSLog, it
retrieves the NSString to be printed by sending the "description"
message to that object.
So, 1) replacing "NSLog" by "printf", 2) replacing "%@" by "%s" and
3) passing the const char* obtained through sending
"cStringUsingEncoding:" (or "UTF8String:" as Greg pointed out) to the
description NSString of the object in question should simulate
NSLog's behaviour pretty well.
What am I missing here? Can you give an example where those
replacements wouldn't fit your needs?
Best regards,
Dirk Stegemann
DATE : Fri Aug 11 18:47:39 2006
Hi,
Am 11.08.2006 um 19:26 schrieb Roland Silver:
> That takes care of the example I gave, but not the general case
> where one wants a format that includes "%@".
As far as I know, when passing an object reference to NSLog, it
retrieves the NSString to be printed by sending the "description"
message to that object.
So, 1) replacing "NSLog" by "printf", 2) replacing "%@" by "%s" and
3) passing the const char* obtained through sending
"cStringUsingEncoding:" (or "UTF8String:" as Greg pointed out) to the
description NSString of the object in question should simulate
NSLog's behaviour pretty well.
What am I missing here? Can you give an example where those
replacements wouldn't fit your needs?
Best regards,
Dirk Stegemann
| Related mails | Author | Date |
|---|---|---|
| Roland Silver | Aug 11, 17:55 | |
| Dirk Stegemann | Aug 11, 17:57 | |
| Roland Silver | Aug 11, 18:08 | |
| Dirk Stegemann | Aug 11, 18:19 | |
| Roland Silver | Aug 11, 18:26 | |
| Piers Uso Walter | Aug 11, 18:41 | |
| Joseph Kelly | Aug 11, 18:41 | |
| Dirk Stegemann | Aug 11, 18:47 | |
| Deborah Goldsmith | Aug 11, 23:41 | |
| Andrew Farmer | Aug 12, 00:28 | |
| Wayne Hasley | Aug 12, 01:28 |






Cocoa mail archive

