How can I do that? What's the format specifier?
For example, I have:
long long veryLong = // assume value here
NSLog(@"%f", veryLong); // of course wrong...
How can I do that? What's the format specifier?
For example, I have:
long long veryLong = // assume value here
NSLog(@"%f", veryLong); // of course wrong...
Try using %lli.
I'd have written simply %lli, but SO doesn't like short answers.
The String Format Specifiers section of the String Programming Guide for Cocoa is a great bookmark for your browser ... ;-)
Yet another way though unnecessary if it's a plain old type and not already an NSNumber, if you convert this to an NSNumber or something similar then the included format method will automatically do the right thing if you just use %@.
long long veryLong = // assume value here
NSLog(@"My long long is: %lld", veryLong); // now it's right