fread'ing and fwrite'ing a structure that contains pointers [duplicate]
问题 This question already has answers here : Writing and reading (fwrite - fread) structures with pointers (3 answers) Closed 4 years ago . gcc (GCC) 4.7.0 c89 Hello, I have the following structure that I am trying to fwrite and fread. However, because my device and resource are pointers. The fwrite will read the pointer values and not the data. I cannot use a array for the device or resource. Only pointers as they have to be dynamically allocated. I allocate all memory for the structure elements