I know that there are a many similar questions out there on stackoverflow.com but I couldn't figure out a solution for myself. After quite some time on research, my brain is broken now even though I think the task I want to do is relatively simple.
So I have two structs:
struct files_t {
file_t *file;
};
struct file_t {
unsigned char *bytes;
unsigned int len;
};
- The first struct
files_tcontains a unknown amount of structs of the second structfile_t. - The second struct
file_tcontains an array ofunsigned charwhich represents the bytes of thefile_tand the length of thisbytes-array.
Then I create myself a pointer to a files_t struct:
files_t* files;
My question now is: How can I iterate through this files struct pointer (Pseudocode: for each file in files) when the amount of file_t's in it is unknown at compile time and also the size of each file_t is unknown at compile time?