This should fill the linked list from a file called "data.txt". For some reason it only fills in the first one. Why?Code:datafile=fopen("data.abd","r"); if(datafile!=NULL){ firstp=malloc(sizeof(struct person)); currentp=firstp; while(1){ newp=malloc(sizeof(struct person)); fread(currentp,sizeof(currentp),1,datafile); if(currentp->next==NULL){ break; } currentp->next=newp; currentp=newp; } fclose(datafile); }
~Sven