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...
long long veryLong = // assume value here
NSLog(@"My long long is: %lld", veryLong); // now it's right
The String Format Specifiers section of the String Programming Guide for Cocoa is a great bookmark for your browser ... ;-)
Try using %lli.
I'd have written simply %lli, but SO doesn't like short answers.
You need %qi, my friend.
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 %@.
int64 / long long int "%lld" uint_32_t "%u"
精彩评论