c语言用fread读取文件中的数据为什么会多读一行?
void browse() {
FILE *fp;
int i, n = 0;
if ((fp = fopen("a.txt", "r")) == NULL) {
printf("打开文件失败\n");
return;
}
while (fread(&s[n], sizeof(struct student), 1, fp) == 1) {
n++;
}
fclose(fp);
for (i = 0; i < n; i++) {
printf("%s%s%s%s\n", s[i].no, s[i].name, s[i].dz, s[i].tel);
}
return;
}