修改模块 你能看出问题吗???!!!!!
void modify(){
int k=0;
int m=0;
long offset;
char numkey[15];
struct person one ;
printf("\n请输入要修改学生的学号:");
scanf("%s",numkey);
if((fp=fopen("student.txt","r+"))==NULL)
{
printf("\n不能建立学生信息管理系统");
exit(0);
}
rewind(fp);
while(!feof(fp))
{ offset=ftell(fp);
fscanf(fp,"%s%s%s%s%s%s%s%s",one.name,one.st_num,one.sex,one.born_ym,one.major,one.class_num,one.address,one.hostelnum);
if(!strcmp(numkey,one.st_num))
{
printf("\n\n已查到,记录为:");
printf("\n\n姓名 学号 性别 出生年月 专业 班级 家庭地址 宿舍电话\n");
printf("%-10s%-10s%-10s%-10s%-10s%-10s%-10s%-10sn",one.name,one.st_num,one.sex,one.born_ym,one.major,one.class_num,one.address,one.hostelnum);
k=1;
}
}
if(k)
{
printf("\n请输入新学生记录:\n");
fscanf("%s%s%s%s%s%s%s",one.st_num,one.sex,one.born_ym,one.major,one.class_num,one.address,one.hostelnum);
fseek(fp,offset,SEEK_SET);
fprintf(fp,"%-10s%-10s%-10s%-10s%-10s%-10s%-10s%-10sn",one.name,one.st_num,one.sex,one.born_ym,one.major,one.class_num,one.address,one.hostelnum);
}
else
printf("\n对不起,没有记录。");
fclose(fp);
system("cls");
}