程序那边错了啊
void changequestion(exam a[],int b)
{ int i,j,chno;
FILE *fp;
fp=fopen("D:\\试题.txt","rb+");
if(fp==NULL)
{
printf("file cannot be opened");
exit(1);
}
j=0;
printf("请按照题号修改");
printf("请输入题号:");
scanf("%d",&chno);
{for(i=0;i<b;i++)
if(a[i].no==chno) break;}
printf("请输入题目:");
getchar();
do
{
a[i].text[j]=getchar();
j++;
}while(a[i].text[j-1]!='\n');
a[i].text[j-1]='\0';
printf("请输入答案:");
scanf("%s",a[i].answer);
for(i=0;i<b;i++)
fwrite(a+i,sizeof(exam),1,fp);
getchar();
printf("修改成功");
getchar();
fclose(fp);
}
无法修改啊。。。。
[解决办法]
step by step debug