C++: copying bmp using loop of fread and fwrite, casues output bmp is filled with color of the fisrt one in input bmp
I dunno why, but first pixel (left bottom) is loaded correctly, but the others won't load a开发者_开发问答nd the first color is used for whole picture...
I have this in cycle
fread(&pix,sizeof(pix),1,pictureIn);
fwrite(&pix,sizeof(pix),1,pictureOut);
edit:
pix is struct of three unsigned chars (rgb), loading file and info header seems to be ok
What OS are you using? I recently had problem with reading binary files under Win32. It turned out that I forgot to pass "b" flag to fopen:
pictureIn = fopen ("in.bmp", "rb");
pictureOut = fopen ("out.bmp", "wb");
精彩评论