I have this code segment meant to read the header from a standard ms paint bitmap.
It reads most of the stuff fine but returns strange values for 0xF9 0xC2 0xD8. (these are actually stored in a char data type but
and returns thisCode:#include <stdio.h> int main(int argc, char *argv[]) { FILE *bmp; char *tmphead; int i; bmp = fopen("image.bmp","rb"); if ( bmp == NULL ) exit(0); fread(tmphead, 1, 0x35, bmp); for (i=0;i<0x35;i++) printf("%X %u\n",tmphead[i],tmphead[i]); fclose(bmp); scanf("%d"); return 0; }
The char is only supposed to hold 8 bits and this is not an 8 bit number.Code:42 66 4D 77 E 14 37 55 2 2 0 0 0 0 0 0 0 0 0 0 36 54 0 0 0 0 0 0 28 40 0 0 0 0 0 0 FFFFFFF9 4294967289 << ? this is not right (should be F9) 0 0 0 0 0 0 FFFFFFC2 4294967234 << ? this is not right (should be C2) 0 0 0 0 0 0 1 1 0 0 18 24 0 0 0 0 0 0 0 0 0 0 FFFFFFD8 4294967256 << ? this is not right (should be D8) 36 54 2 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
I have compiled this with gcc distributed through Dev-Cpp package.



LinkBack URL
About LinkBacks


