C语言问题求教 关于文件fatal error C1010: unexpected end of file while looking for precompiled h

#include "stdio.h"
#include "stdlib.h"
void main( )
{ FILE *infp,*outfp; char ch;
if ((infp=fopen(“c:\\infile.c”, “r”))== NULL)
{ printf(“Cannot open this infile. \n”);
exit(0);
}
if ((outfp=fopen(“c:\\outfile.c”, “w”))== NULL)
{ printf(“Cannot open this outfile. \n”);
exit(0);
}
 while(!feof(infp))
   if((ch=fgetc(infp))!=EOF)
     fputc(ch,outfp);
  fclose(infp);
  fclose(outfp);
}
fatal error C1010: unexpected end of file while looking for precompiled header directive
Error executing cl.exe.

// 双引号用错了,换成半角双引号即可

#include <stdio.h>
#include <stdlib.h>

void main() {
FILE *infp,*outfp;
char ch;
if((infp = fopen("c:\\infile.c","r")) == NULL) {
printf("Cannot open this infile. \n");
exit(0);
}
if((outfp = fopen("c:\\outfile.c","w")) == NULL) {
printf("Cannot open this outfile. \n");
exit(0);
}
while(!feof(infp))
if((ch = fgetc(infp)) != EOF)
fputc(ch,outfp);
fclose(infp);
fclose(outfp);      
 }

追问

依然无法通过啊,还是那个错误

追答

你把我上传的代码复制到你的编译环境,再编译看看,如果仍出现这样的错误,可能是的编译器有问题,该重新安装或更换了。

温馨提示:内容为网友见解,仅供参考
第1个回答  2013-08-14
C1010是预编译错误,修改这个错误的关键在于在文件的最开始添加一行:
#include "stdafx.h"

之后还有一些语法错误,xoaxa都已经修改过来了。本回答被网友采纳
第2个回答  2013-08-19
你这是从编译器中复制过来的吗??
里边的符号都是中文符号啊!!引号什么的
=======================
楼主问题不管啦??

...error C1010: unexpected end of file while looking for precomp...
include <stdio.h>#include <stdlib.h>void main() {FILE *infp,*outfp;char ch;if((infp = fopen("c:\\\\infile.c","r")) == NULL) {printf("Cannot open this infile. \\n");exit(0);}if((outfp = fopen("c:\\\\outfile.c","w")) == NULL) {printf("Cannot open this out...

相似回答