Reading a data from a file and writing it to a linked list
问题 #include<stdio.h> struct Node{ char *name; int time; int sec; int x; int y; struct Node *next; }; int main(){ FILE *file; int index; struct Node *data=malloc(sizeof(struct Node)); struct Node *tmp=data,*tmp2=data; int enter; file=fopen("data.txt","r"); if(file==NULL){ printf("File was not opened!\n"); return 0; } while(!feof(file)){ tmp=malloc(sizeof(struct Node)); fscanf(file,"%d",&index); fscanf(file,"%d",&tmp->time); fscanf(file,"%d",&tmp->sec); fscanf(file,"%d",&tmp->x); fscanf(file,"%d",