#include <stdio.h>
#include <process.h>
#define SIZE 6
typedef struct member
{
char name[100];
double salary;
double tax;
}stuw;
void acceptdata(struct member stu[])
{
int i;
for(i=0;i<SIZE;i++)
{
printf("Enter employee information:");
scanf("%s",stu[i].name);
scanf("%lf",&stu[i].salary);
}
}
void output(struct member stu[],FILE *fp)
{
if((fwrite(stu,sizeof(stuw),SIZE,fp)!=SIZE))
printf("file write error\n");
}
int main()
{
FILE *fp;
struct member stu[SIZE];
if(fp=fopen("c:\\cyuyan\\member.din","wb")=="NULL")
{
printf("\ncannot open file\n");
exit(1);
}
acceptdata(stu);
output(stu,fp);
fclose(fp);
return 0;
}