tags:

views:

18

answers:

2
+2  A: 

You need to open the file in binary mode:

fd = fopen("test.bmp", "rb");

If you try to read a binary file like a bitmap in text mode, the bytes corresponding to carriage returns and linefeeds confuse things.

anon
Thank you for you quick answer!
bAp
A: 

Please look at this question http://stackoverflow.com/questions/1047723/reading-bytes-from-bmp-file.

Looks like problem is in the mode of opening it.

Praveen S