Alex Rivera | Logout

Store hex value into NSData

Asked 2012-10-17T07:21:09.723
11

I'm confused on how to store a hex value into NSData. I want the value I will be storing to be 0x0F.

Please could someone give me an example?

Edit
Report

1 Answer

11

Here's how I've done that before:

UInt8 j= 0x0f;
NSData *data = [[[NSData alloc] initWithBytes:&j length:sizeof(j)] autorelease];
answered 2012-10-17T07:29:18.053

Your Answer