I have Receiving NSData like 210502113c4d from the server . I am getting this data into NSString format . I want to retrieve the 3 byte from this incoming data i.e. 2105 02 113c4d. I have tried following :
NSData *demoData=[string dataUsingEncoding:NSASCIIStringEncoding];
NSLog(@"demo data :%@",demoData);
const char *bytes=[data bytes];
NSMutableString *result = [NSMutableString string];
for (int i = 0; i < [demoData length]; i++)
{
[result appendFormat:@"%02hhx", (unsigned char)bytes[i]];
}
But its not working . Please suggest me some solution to achieve this ?