这段程序为何运行不了,总出现文件已停止工作,望高手指点
#include<stdio.h>main()
{
char *filename;
FILE *fp1,*fp2;
int i,number;
fp1=fopen("TEST","w");
for(i=1;i<=100;i+=10);
putw(i,fp1);
fclose(fp1);
printf("\ninput filename\n");
open_file:
scanf("%s",filename);
if((fp2=fopen(filename,"r"))==NULL)
{
printf("cannot open the file\n\n");
printf("type filename again\n");
goto open_file;
}
else
for(i=1;i<=100;i+=10)
{number=getw(fp2);
if(feof(fp2))
{
printf("\ran out of data\n");break;
}
else
printf("%d\n",number);
}
fclose(fp2);
}