Very basic Question. :(. I have a hex value and trying to accommodate into NSData, and
tried the following.
unsigned char bytes [] = {0x0f0121dd06a2d00503040705aa010ba2d0a2d0};
NSData *data = [NSData dataWithBytes: bytes length:19];
NSLog (@" DAta is %@ ", data);
I m getting the following Warning
34:37: warning: integer constant is too large for its type
34: warning: large integer implicitly truncated to unsigned type
Data is printed like:
NSDataExample[36136:707] DAta is <d028e08c 7fff7f00 00000000 00000000 0008fc>
I m not sure if i m doing it in a right way?. Kindly advice.
You aren’t assigning the
chararray properly it seems; because it is too large for the type you’re assigning. How about this, as an example:Prints
2012-11-19 06:40:07.581 Untitled 2[12472:707] Data is <0f0121>to the consoleOr, if your hex bytes are in the form of a string, something like this:
Which prints
2012-11-19 06:56:15.753 TestHexStringToBytes[12891:303] main - data = <0f0121dd 06a2d005 03040705 aa010ba2 d0a2d0>to the console.