hi, i am trying to sort a file and i keep getting a run failed when i call the method sortList.I have gone through my code but i cant find any errorCode:void sortList(FILE *p,int noofchil){ struct child *temp3; struct child *temp1; struct child *temp2;; int in; int out; printf("dd"); for(out=noofchil-1;out>1;out--) { for(in=0;in<out;in++) { fseek(p,sizeof(struct child)*in ,SEEK_SET); fread(temp1,sizeof(struct child),1,p); fseek(p,sizeof(struct child)* (in +1) ,SEEK_SET); fread(temp2,sizeof(struct child),1,p); if(compareChilds(temp1,temp2)==1) { temp3=temp2; temp2=temp1; temp1=temp3; fseek(p,sizeof(struct child)*in ,SEEK_SET); fwrite(temp1,sizeof(struct child),1,p); fseek(p,sizeof(struct child)*(in+1) ,SEEK_SET); fwrite(temp1,sizeof(struct child),1,p); } } } }



LinkBack URL
About LinkBacks



