文件打开写不进去
#include<stdio.h>#define N 10
main()
{
FILE *fp;
int a[N],i,count,b[N]={0};
printf("input%dnumbers",N);
for(i=0;i<N;i++)
scanf("%d",&a[i]);
if(fp=(fopen("mydate","w+"))==NULL)
{
printf("can't open the file\n");
return;
}
count=fwrite(a,sizeof(int),6,fp);/*写不进去count也不等于6*/
rewind(fp);
if(fread(b,sizeof(int),6,fp)!=6);
{
printf("error");
return;
}
fclose(fp);
for(i=0;i<6;i++)
printf("%d\n",b[i]);
}