enter code here
void fileCopy( const char * targetFilePath, const char * toPlace ){
FILE * istream, * ostream; //
if(( istream = fopen( targetFilePath, "r" )) == NULL ){
printf("文件不存在!");
exit( 0 );
}
ostream = fopen( toPlace, "w");
char ch;
while( (ch=fgetc(istream)) != EOF ){
cout<<ch<<" ";
fputc( ch, ostream );
}
fclose( ostream );
}
void main( ){
// const char * from = "D://a.jpg";
// const char * to = "D://b.jpg";
const char * from = "D://data.txt";
const char * to = "D://b.txt";
fileCopy( from, to );
cout<<"完成!"<<endl;
}
为什么复制txt文件读取没问题,但是复制图片文件有问题,望大神求解?