C++:使用 fread 和 fwrite 循环复制 bmp,导致输出 bmp 填充输入 bmp 中第一个 bmp 的颜色
我不知道为什么,但第一个像素(左下)已正确加载,但其他像素不会加载,并且第一个颜色用于整个图片...
我在循环
fread(&pix,sizeof(pix),1,pictureIn);
fwrite(&pix,sizeof(pix),1,pictureOut);
编辑中有这个:
pix 是三个无符号字符的结构(rgb ),加载文件和信息头似乎没问题
I dunno why, but first pixel (left bottom) is loaded correctly, but the others won't load and 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您使用什么操作系统?我最近在 Win32 下读取二进制文件时遇到问题。事实证明,我忘记将“b”标志传递给 fopen:
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: