while(!feof(fp))死循环怎么办?求助
int load(){
FILE*fp;
struct systm sb[N];
fp=fopen("D:\\z\\systm\\subjct.dat","rb");
int i=0,g=0,j=0;
if((fp=fopen("D:\\z\\systm\\subjct.dat","rb"))=NULL)
{
printf("\nCan not open load file\n");
exit(1);
}
while(!feof(fp))
{
if(1!=fread(&sb[i],sizeof(struct systm),1,fp)) break;
i++;
++j;
++g;
}
fclose(fp);
printf("%d",g);
return(g); //返回课程信息记录个数
}