这个程序哪里错了吗 运行不了

问题描述:

#include  <stdio.h>
#include  <string.h>
main()
{  char a,str[80]="The quick brown fox jumps over a lazy dog.";
   FILE*fp;
   int i=0;
   if ((fp=fopen("e:\\abc.txt","w+"))==NULL
   {  printf("Cannot open the file!\n");  exit(0);}
   while(str[i])  { putc(str[i],fp);i++; }
   putc(0xff,fp);
   rewind(fp);
   a=getc(fp);
   while(a!=EOF)  { putchar(a); a=getc(fp);}
   putchar('\n');
   fclose(fp);
   system("pause"); 
}

 if ((fp=fopen("e:\\abc.txt","w+"))==NULL这一行你少了右括号。

 if ((fp=fopen("e:\\abc.txt","w+"))==NULL)就可以了

还有改成void main()嘛,不知道是不是因为版本问题

为什么你if 不添加结尾 )呢。 加了就过了。