关于/bv. “stdafx.h”#include”stdlib.h”intmain(intargc,char*argv[]){FILE*fP1;FILE*fp2;charch;if((fp1=fopen(“d:\\用户目录\\file1.txt”,”r”))==0){printf(“cannotopenthisfile\n”);exit(1);if((fp2=fopen(“d:\\用户目录\\file1.txt”,”w”))==0){printf(“cannotopenthisfile\n”);exit(1);while((ch=fgetc(fp1))!=EOF){fp2=(ch,fp2);}free(fp1);free(fp2);return0;}问题是:\MSDev98\MyProjects\bv\bv.cpp(11):errorC2065:’fp1′:undeclaredidentifierE:\MSDev98\MyProjects\bv\bv.cpp(11):errorC2440:’=’:cannotconvertfrom’struct_iobuf*’to’int’Thisconversionrequiresareinterpret_cast,aC-stylecastorfunction-stylecastE:\MSDev98\MyProjects\bv\bv.cpp(21):fatalerrorC1903:unabletorecoverfrompreviouserror(s);stoppingcompilation执行cl.exe时出错.bv.exe-1error(s),0warning(s)求大神的问题
应该是没有找到FILE定义。
在文件开头加入
#include “stdio.h”