Write dynamically allocated structure to file
问题 Suppose we have following structure: struct Something { int i; }; If I want to write in a file any data of this type(dynamically allocated), I do this: struct Something *object = malloc(sizeof(struct Something)); object->i = 0; // set member some value FILE *file = fopen("output_file", "wb"); fwrite(object, sizeof(struct Something), 1 file); fclose(file); Now, my questions: How we do this with a structure what contains pointers? I tested using same method, it worked fine, data could been read