Hello,
I receive a payload which a byte stream:
e.g.
Code:
typedef unsigned char uint8;
typedef unsigned int uin16;
//Following is the payload:
uint8 data[] = {0x01,0x02,0x03,0x04,0x05,0x06,0x08,0x09,0x11}
//now i need to parse them to fill the structure defined below
typedef struct
{
uint16 a;
uint8 b;
char c;
uint8 d;
uint16 e;
}test;
besides parsing each byte and filling the structure members.
Is there any other way to directly fill the structure as a whole?.
Code ex: will help.
I tried doin this....but the device is throws exception:
Code:
test * parsed;
uint8 *u8EPt = data;
memcpy(parsed,(test *)u8EPt,sizeof(test ));
Thanks