掉了两个反括号,代码表出来了,如下:
#include
#include
#define SIZE 9
typedef struct tax_st
{
long left;
long right;
int tax;
long deduct;
} TAX_LIST;
void acceptdata(TAX_LIST tax_list[])
{
int i;
for (i=0; i{
printf("Please enter data:");
scanf("%ld",&tax_list[i].left);
scanf("%ld",&tax_list[i].right);
scanf("%d",&tax_list[i].tax);
scanf("%ld",&tax_list[i].deduct);
}
}
int main()
{
FILE *fp;
TAX_LIST tax_list [SIZE];
if(((fp=fopen("D:\\各种\\C语言\\vc\\书上的例子\\TAX.din","wb")) == NULL))//掉了反括号
{
printf("\ncannot open file\n");
exit(1);
}
acceptdata(tax_list);
if ((fwrite(tax_list,sizeof(TAX_LIST),SIZE,fp)!=SIZE))//掉了反括号
printf("file write error\n");
fclose (fp);
return 0;
}