I need to convert a formated data to struct like this:
struct header
{
int a;
int b;
char c;
}
I have to do it manually like this:
[data getBytes:&h.a range:(NSRange){0,4}];
[data getBytes:&h.b range:(NSRange){4,4}];
[data getBytes:&h.c range:(NSRange){8,2}];
Is there a better way to convert the data to struct?
1 Answer