开发者

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");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜