[求助]一个文件输入程序有问题
#include "stdio.h"main()
{
FILE * fp;
char ch;
if((fp=fopen("file1.txt","w")==NULL))
{
printf("cannot open file\n");
exit(0);
}
while((ch=getchar())!='\n')
fputc(ch,fp);
fclose(fp);
}
运行以后我输入一些字符,结果却是NULL PIONTER ASSIGNMENT请问是怎么回事啊