c图片文件读取问题,坐等大神

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文件读取没问题,但是复制图片文件有问题,望大神求解?

图片一般是二进制的,用fread/fwrite接口,并用二进制读写模式就可以了。fgetc/fputc更多的是处理文本的。