为啥输不出想要的结果呢?即EVEN文件的内容
#include<stdio.h>main()
{
FILE *f1, *f2;
int number, i;
printf("Contents of Data file\n\n");
f1 = fopen("DATA","w");
for(i=1;i<=30;i++)
{
scanf("%d",&number);
if(number=-1) break;
putw(number,f1);
}
fclose(f1);
f1 = fopen("DATA","r");
f2 = fopen("EVEN","w");
while((number=getw(f1))!=EOF)
if(number%2==0)
putw(number,f2);
fclose(f1);
fclose(f2);
f2 = fopen("EVEN","r");
printf("\n\nContents of EVEN file\n\n");
while((number=getw(f2))!=EOF)
printf("%4d",number);
fclose(f2);
}