为什么?
void recompose()/*修改用户信息*/{
FILE *fp1;
int n,i;
char name,sex,address;
int age,phone;
if((fp1=fopen("d:\\user.dat","rb+"))==NULL)
{
printf("cannot open file");
exit(1);
}
for(i=0;i<MAXUSER;i++){
fread(&record[i],sizeof(struct news),1,fp1);
printf("%s%s%d%d%s\v",record[i].name,record[i].sex,record[i].age,record[i].phone,record[i].address);
}
scanf("%d",&n);
printf("修改第%d条信息",n);
fseek(fp1,(n-1)*sizeof(struct news),0); /* 定位文件指针指向第n条记录*/
printf("输入修改的姓名:");
scanf("%s",name);
printf("输入修改的性别:");
scanf("%s",sex);
printf("输入修改的年龄:");
scanf("%d",&age);
printf("输入修改的电话:");
scanf("%d",&phone);
printf("输入修改的地址:");
scanf("%s",address);
record[n-1].name=name;
record[n-1].sex=sex;
record[n-1].age=age;
record[n-1].phone=phone;
record[n-1].address=address;
fprintf("%s %s %d %d %s \v",record[n-1].name,record[n-1].sex,record[n-1].age,record[n-1].phone,record[n-1].address);
rewind(fp1);
fclose(fp1);
}
关于信息修改,我将文件指针移动到修改的地方,用输入的其他信息替换,之后重新输入,为什么不对?
D:\桌面文件\桌面\Debug\CANTING.CPP(421) : error C2664: 'fprintf' : cannot convert parameter 1 from 'char [17]' to 'struct _iobuf *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
提示信息是这样的