C语言图书系统显示图书板块关于读取的问题
代码如下int show()//显示图书
{
system("cls");
int n = 0;
struct book c;
FILE * qx;
qx=fopen( "C:\\C语言作业\\图书信息.txt", "rb");
for (int i = 0; i < 50; i++)
{
fread(&c, size_t(struct book), size_t(struct book), 1, qx);
}fclose(qx);
int k = 0;
for (int j = 0; j < 100; j++)
{
if (c.bnum > 0)
k++;
}
for (int i = 0; i < k; i++)
{
printf("序号:%d ,书名:%s , 作者:%s 出版社:%s 库存:%d 原有数:%d \n",books.bnum,books.bname,books.aname,books.print,books.total,books.store);
}
}
显示错误代码
fread(&c, size_t(struct book), size_t(struct book), 1, qx);
显示错误原因
expected primary-expression before '(' token
expected primary-expression before 'struct'
怎么回事啊?求大神解答 查了一下fread函数。该函数只有四个参数,你为什么有五个?
页:
[1]