How do I print all the fieldnames of a struct which also has sub structs in them comma separated?.
typedef struct logTimestamp_s{
unsigned short lower;
unsigned short tsLow;
unsigned int tsHigh;
} logTimestamp;
typedef struct logHeader_s{
unsigned short length;
unsigned short code;
logTimestamp ts;
} logHeader;
typedef struct __attribute__ ((__packed__)){
logHeader hdr; //12
unsigned int res1; //16 unknown 4 bytes.
unsigned char id; //17 /* sub packet id */
unsigned char ver; //18 /* sub packet version */
unsigned short size; //20 /* sub packet size */
unsigned int res2; //24 unknown 4 bytes.
}log11AB;
For ex, I am looking for a way to obtain printout like :
"length, code, lower, tsLow, tsHigh, res1, id, ver, size, res2"
Thanks!