#include <stdio.h>
struct struct_type
{
int d;
};
int main()
{
struct struct_type *cust;
cust->d=13;
FILE* fp;
fp = fopen("path to file", "wb+");
or,
fp = fopen("path to file", "w+");
fwrite(cust, sizeof(struct struct_type), 1, fp);
fclose(fp);
return 0;
}
预期产出
13
但是将垃圾值写入文件。