Search code examples
objective-ccocoa-touchnsstringprintfnslog

How to use printf with NSString


I need to use something like NSLog but without the timestamp and newline character, so I'm using printf. How can I use this with NSString?


Solution

  • You can convert an NSString into a UTF8 string by calling the UTF8String method:

    printf("%s", [string UTF8String]);