Hello
I'm still kinda new at C and I have this buffer filled with data that I want to to 'parse' into a an array of structs. How do I do this?
The only thing I can think of is for-loops, kinda 'bytewise', but there must be a better way?
It's something like this:
I allocate memory for the tablearray, data is read into the buf and then, how do I 'fill' the structs? The data in the buffer is of course 'structdata', I mean of the kind 'length,offset, name,length,off set,name...."
Hope someone knows what I mean and can help me, that would be so very kind of you!
Cheers!
I'm still kinda new at C and I have this buffer filled with data that I want to to 'parse' into a an array of structs. How do I do this?
The only thing I can think of is for-loops, kinda 'bytewise', but there must be a better way?
It's something like this:
Code:
char buf[BUFSIZE];
struct table_entry{
int length;
int offset;
char *name;
}
struct table_entry *tablearray = NULL;
Hope someone knows what I mean and can help me, that would be so very kind of you!
Cheers!
Comment