<pre>void inb(sqlist &l) //添加图书信息到文件(仅管理员可用)
{
FILE fp;
book *p;
int i;
if((fp=fopen("C:\Users\Administrator\Desktop\library.txt","ab"))==NULL)
{
printf("储存文件失败!");
return;
}
printf("请输入要添加的图书信息(图书编号为已有书数量'listsize+1'):图书编号 书名 作者名 库存数量 最近归还剩余天数(初始化为0)");
scanf("%d%s%s%d%d",&p->number,p->bname,p->writer,&p->quantity,&p->time);
if(l.listsize+1>l.length)
{
printf("储存位置已满!");
return;
}
l.b[l.listsize]=*p;
if(fwrite(&l.b[l.listsize],sizeof(struct book),1,fp)!=1)
printf("数据储存失败!");
l.listsize++;
fclose(fp);
return;
}</pre>
编写的是图书管理系统,这只是其中一段代码,就是这里卡住做不下去了,错误提示在下面。
error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'struct _iobuf *' (or there is no acceptable conversion)
error C2664: 'fwrite' : cannot convert parameter 4 from 'struct _iobuf' to 'struct _iobuf *'No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
error C2664: 'fclose' : cannot convert parameter 1 from 'struct _iobuf' to 'struct _iobuf *'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
onemoo
oO王
相关分类