Hi,

I have a struct that I need to convert to a byte(=char) array. Normally, I know how to do that using memcpy() but in this case the struct contains a pointer that I use to allocate memory dynamically elsewhere is my program.

Something like:

Code:
struct my_struct {
    int size;
    int num;
    int *list;
} sb;
and later on:
Code:
sb.list = (int*)malloc(some_var);
Is this even possible? If it is, what approach should I follow?

Thanks.