编译文件操作时出现错误,帮忙看下原因,谢谢。。
程序代码:/*
读取一个文件A,并写入文件B中
*/
# include <stdio.h>
int main(void)
{
FILE *fpI = NULL; //声明文件指针fpI,输入字符用
fpI = fopen("E:\\Ctool\\product\\A.txt","rt"); //以只读文本方式打开txt文件
if(fpI = NULL) //放错处理
{
printf("输入文件打开失败,请检查");
return 0;
}
FILE *fpO = NULL;
fpO = fopen("E:\\Ctool\\product\\B.txt","wt");
if(fpO = NULL)
{
printf("输出文件打开失败,请检查");
return 0;
}
char temp = '\0';
while(!feof(fpI)) //到达输入文件末尾时停止
{
temp = fgetc(fpI);
if(temp != EOF)
fputc(temp, fpO);
}
fclose(fpO);
fclose(fpI);
return 0;
}win7系统用VC++6.0编译时,出现以下错误警告,我是照着书上输入的,不知道为什么会出现这些问题
--------------------Configuration: 文件操作 - Win32 Debug--------------------
Compiling...
文件操作.c
e:\ctool\product\文件操作.c(12) : error C2275: 'FILE' : illegal use of this type as an expression
e:\ctool\ctool\vc++6.0\vc98\include\stdio.h(156) : see declaration of 'FILE'
e:\ctool\product\文件操作.c(12) : error C2065: 'fpO' : undeclared identifier
e:\ctool\product\文件操作.c(13) : warning C4047: '=' : 'int ' differs in levels of indirection from 'struct _iobuf *'
e:\ctool\product\文件操作.c(14) : warning C4047: '=' : 'int ' differs in levels of indirection from 'void *'
e:\ctool\product\文件操作.c(19) : error C2143: syntax error : missing ';' before 'type'
e:\ctool\product\文件操作.c(22) : error C2065: 'temp' : undeclared identifier
e:\ctool\product\文件操作.c(24) : warning C4047: 'function' : 'struct _iobuf *' differs in levels of indirection from 'int '
e:\ctool\product\文件操作.c(24) : warning C4024: 'fputc' : different types for formal and actual parameter 2
e:\ctool\product\文件操作.c(26) : warning C4047: 'function' : 'struct _iobuf *' differs in levels of indirection from 'int '
e:\ctool\product\文件操作.c(26) : warning C4024: 'fclose' : different types for formal and actual parameter 1
执行 cl.exe 时出错.
文件操作.obj - 1 error(s), 0 warning(s)









