How to use printf with NSString

node ninja picture node ninja · Sep 26, 2010 · Viewed 43.1k times · Source

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?

Answer

Jacob Relkin picture Jacob Relkin · Sep 26, 2010

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

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