0

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

Lukas
  • 41
  • 3
  • You haven't given enough information. What is pix? How do you know the size? – dmazzoni Dec 10 '09 at 21:30
  • Do you actually check the return values so you can tell if something went wrong? – Anon. Dec 10 '09 at 21:31
  • 1
    And presumably you opened a file? How did you do it? Did you, for example, open it in binary mode? And is this in a loop? You get the idea - we are not mind readers. –  Dec 10 '09 at 21:33

1 Answers1

1

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