Re: C programming question
What a great little learning project.
My suggestion is to work out a simpler version of what you are trying to do:
typedef struct {
unsigned short rec_type;
long data;
} type1;
typedef struct {
unsigned short rec_type;
char data[4];
} type2;
.....
some_type *chunk_of_mem;
long a = ((type1 *) chunk_of_mem)->data;
char *b = ((type2 *) chunk_of_mem)->data;
.....
and either work out how to get the union syntax or casting. Both
should work equally well. One may be easier to work though with you
compiler.
Rob.
Reply to: