Tuesday, 27 August 2013

NSData to unsigned char *

NSData to unsigned char *

I need to convert NSData to something like unsigned char b[16]. This is
what I have so far.
NSData *c = [@"testingsomething" dataUsingEncoding:NSUTF8StringEncoding];
unsigned char *a = (unsigned char *)[c bytes];
NSLog(@"size of a is %ld", sizeof(a));
unsigned char b[16] = "testingsomething";
NSLog(@"size of b is %ld", sizeof(b));
The output I get is;
size of a is 4
size of b is 16
How can I do this? Help would be greatly appreciated.

No comments:

Post a Comment