나는 이런 식으로 뭔가를 파일로 저장하는 방법 :동적 구조체이보다 사실 더 복잡한 구조체를
typedef struct _sample {
unsigned char type;
char *name;
test *first;
} sample;
typedef struct _test {
test *prev;
test *next;
char *name;
int total;
test_2 **list;
} test;
typedef struct _test_2 {
char *name;
unsigned int blabla;
} test_2;
sample *sample_var;
나는 백업 파일에이 구조체를 원하고 후 복원.
나는 또한 fwrite(sample_var, sizeof(sample), 1, file_handle);
으로 시도하지만 실제 크기는 실제 크기가 아니라 잘못된 크기를 반환하는 sizeof(sample)
입니다.
크기를 모르더라도 & 파일로 복원하는 방법이 있습니까?
@OP 저희에게 알려주세요. – cnicutar