Strange hex formatting in NSString
- by pseudopeach
Try this:
unsigned long long int N; = 23229877463LL;
NSString* s = [NSString stringWithFormat:@"dec:%qi, hex:%qX",N,N];
NSLog(@"output: %@",s);
output: dec:23229877460, hex:689BCCD400000005
What's up with the 00000005??? In mySQL, hex(23229877460) = 5689BCCD4. Also, every other language seems to do this correctly. A 16 digit long hex is like 4 gazillion (16^16), right?
How can I get objective-c to format hex numbers that other languages can understand?