int 共有幾個元素;
int saveFile(){
move_phase=0;
picked=-1;
FILE *f1;
f1 = fopen ("save", "wb");
int i;
fprintf(f1,"%d ",共有幾個元素);
printf("[[%d ]]",共有幾個元素);
for(i=0;i<共有幾個元素;i++){
int j=0;
fwrite(poly,sizeof(struct POLYGONS),共有幾個元素,f1);
}
fclose (f1);
}
int readFile(){
move_phase=0;
picked=-1;
FILE *fPtr;
fPtr = fopen("save", "rb");
if (!fPtr) {
printf("檔案開啟失敗...\n");
return 0;
}
int status,i=0;
fscanf(fPtr,"%d ",&共有幾個元素);
status=fread(poly,sizeof(struct POLYGONS),共有幾個元素,fPtr);
printf("FETCHED %d POLYGONS@",status);
display();
fclose(fPtr);
return 0;
}
留言列表