0x00429af0 if(fp==NULL) { printf(" 不能打开文件\n"); exit(0); } rewind(fp);// 指向文件的开始 while(!feof(fp))// 查找{ Student a; while(!feof(fp)) { fread(&a,sizeof(Student),1,fp);// 从p 指向的文件读入一组数据 if(!strcmp(a.name,surch)) { printf("%s,%s,%s\n",a.num,a.name,a.address); break; }} if(!feof(fp)) {return;} else { printf(" 查无此人···· \n"); }} fclose(fp); getchar(); system("cls"); } void num_surch() { FILE *fp; char surch[256]; printf(" 请输入要查询的人的学号: "); gets(surch); fp=fopen("D:\\stduent.txt","rb");//0x0042aab8 if(fp==NULL) { printf("ERROR"); exit(0); } rewind(fp);// 指向文件的开始 while(!feof(fp))// 查找{ Student a; while(!feof(fp)) { fread(&a,sizeof(Student),1,fp);// 从p 指向的文件读入一组数据 if(!strcmp(a.num,surch)) { printf("%s,%s,%s\n",a.num,a.name,a.address); break; }} if(!feof(fp)) {return;} else { printf(" 查无此人···· \n"); }}