Try to use %llu
instead of %u
.
Objective-C consecutive format specifiers printing 0
-
09-03-2022 - |
Question
This is a little problem I am having, and although it seems to be basic and simple I cannot find it out, here is the code:
int main (int argc, const char * argv[]) {
unsigned long long ep = 2292674165ul;
unsigned long long ep2 = 2487148347ul;
NSLog(@"%u", ep );
NSLog(@"%u", ep2);
NSLog(@"%u %u", ep , ep2);
// a last try..
NSLog(@"%@",[NSString stringWithFormat:@"%u %u", ep , ep2]);
}
Its output:
2013-02-14 13:26:15.968 FTPTests[5274:1307] 2292674165
2013-02-14 13:26:15.970 FTPTests[5274:1307] 2487148347
2013-02-14 13:26:15.971 FTPTests[5274:1307] 2292674165 0
2013-02-14 13:26:15.972 FTPTests[5274:1307] 2292674165 0
Can someone tell me why the second specifier is printing 0? How can I solve it?
Thanks!
Solution
OTHER TIPS
I believe you're using the incorrect format specifier try using %llu
. The compilers warns you when you compile it.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow