FILE*fp遇到问题!怎么定义呀?
#include <string.h>#include <stdlib.h>
#define SIZE 4
struct ms_type
{
char name[20];
char writer[10];
char singer[10];
char date[6];
}ms[SIZE];
void save()/*输入*/
{
FILE*fp;
int i;
if((fp=fopen("ms_list","wb"))==NULL)
{printf("connot open file\n");
return;
}
for(i=0;i<SIZE;i++)
if(fwrite(&ms[i],sizeof(struct ms_type),1,fp)! =1)
printf("file write error\n");
fclose(fp)
}
main()
{
int i;
for(i=0;i<SIZE;i++)
scanf("%s%s%s%s",ms[i].name,&ms[i].writer,&ms[i].singer,&ms[i].date);
save();
int t;
file*fp;
fp=fopen("ms_list,"rb"");
for(t=0;t<siza;t++)
{
fread(&ms[t],sizeof(struct ms_type),1,fp);
printf("&%-20s %-10s %-10s %-6s \n,ms[t].name,ms[t].writer,ms[t].singer,ms[t].date")
}
fclose(fp)
}