Objective-C Decimal to Base 16 Hex conversion

Posted by JustinXXVII on Stack Overflow See other posts from Stack Overflow or by JustinXXVII
Published on 2010-05-15T16:27:05Z Indexed on 2010/05/15 16:34 UTC
Read the original article Hit count: 300

Filed under:
|
|
|

Does anyone have a code snippet or a class that will take a long long and turn it into a 16 byte Hex string?

I'm looking to turn data like this

long long decimalRepresentation = 1719886131591410351;

and turn it into this

//Base 16 Hex Output: 17DE435307A07300

The %x operator doesn't want to work for me

NSLog(@"Hex: %x",decimalRepresentation);
//console : "Hex: 7a072af"

As you can see that's not even close. Any help is truly appreciated!

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about hex