copying the contents of an image file
Posted
by Ganesh
on Stack Overflow
See other posts from Stack Overflow
or by Ganesh
Published on 2010-05-03T12:00:20Z
Indexed on
2010/05/03
12:08 UTC
Read the original article
Hit count: 194
I am designing an image decoder and as a first step I tried to just copy the using c. i.e open the file, and write its contents to a new file. Below is the code that I used.
while((c=getc(fp))!=EOF)
fprintf(fp1,"%c",c);
where fp is the source file and fp1 is the destination file. The program executes without any error, but the image file(".bmp") is not properly copied. I have observed that the size of the copied file is less and only 20% of the image is visible, all else is black. When I tried with simple text files, the copy was complete.
Do you know what the problem is?
© Stack Overflow or respective owner