I'm trying to parse a binary file.
The file consists of multiple header->record pairs.
The record length and type are stored in the header.
I want to be able to read the entire header into a buffer and then split it into the variables.
Unfortunately I can't figure out how to do it.
#define HEADER_SIZE 4
typedef struct rHead
unsigned short int REC_LEN;
unsigned char REC_TYP;
unsigned char REC_SUB;
recHead readHeader(char *buffer)
/* no idea how to parse it */
buffer = (char *)malloc(HEADER_SIZE+1);
recHead header = readHeader(buffer);