> is there an alternative to (56), like a way to represent sizeof(struct) - sizeof(struct value).
Well yes, sizeof(struct) - sizeof(struct value) should work, given the right things to do sizeof on.
Type: Posts; User: Salem
> is there an alternative to (56), like a way to represent sizeof(struct) - sizeof(struct value).
Well yes, sizeof(struct) - sizeof(struct value) should work, given the right things to do sizeof on.
Good - so you do have structs which don't contain pointers.
The first thing to look into is offsetof() which grumpy mentioned earlier. This will allow you to get to the field of interest in the...
@generaltso78
You need to post your actual struct, and the code you use to fwrite it to a file.
Without it, it's impossible to tell whether any of your fseek / fread code makes any sense at all.
So exactly how are you serialising the struct then?
If you have (as a result) variable length records because you're outputting variable length strings, then using fseek() to go to a particular...
> The struct holds various data char *, ints and floats.
Therein lies the problem.
You can't just fwrite the contents of a struct, if it contains pointers.
struct foo {
char *a;
} bar;...