Save struct with pointer members in file
问题 I'm trying to save a struct into a .dat file and read it back in later. struct myStruct{ char **one; mytype **two; mytype2 *three; } With an assigning function: struct MyStruct get_struct() = { char **pi = ...; mytype **pa = ...; mytype2 **po = ...; MyStruct n = {pi, pa, po}; return n; } I originally tried to save this struct into a .dat file by doing this: struct MyStruct s = get_struct(); myoutfile = fopen("file.dat", "w"); if (myoutfile == NULL) { fprintf(stderr, "\nError opend file\n");