4 int main(int argc
, char *argv
[])
6 printf("HEXCMP 0.3\nHexadecimal Comparator\n<-Harvie 2oo7\n\n");
8 printf("Usage: hexcmp oldfile newfile [decimal_offset_to_start_at]\n");
9 printf("This will show what is new in \"newfile\",\n");
10 printf("this can be useful, when making binary patchers.\n\n");
15 printf("Comparing old \"%s\" with new \"%s\"\n", argv
[1], argv
[2]);
18 forig
= fopen(argv
[1], "rb");
19 if(forig
== NULL
) { printf("Error while opening %s\n", argv
[1]); return 0; }
20 fcrac
= fopen(argv
[2], "rb");
21 if(fcrac
== NULL
) { printf("Error while opening %s\n", argv
[2]); return 0; }
24 unsigned long int offset
= 0, last
= 0, end
= 0, dlen
= 0;
25 int corig
= 0, ccrac
= 0;
28 offset
= atof(argv
[3]);
29 printf("Comparing from offset D: %d H: 0x%x\n", offset
, offset
);
34 fseek(forig
, offset
, SEEK_SET
);
35 fseek(fcrac
, offset
, SEEK_SET
);
37 while((ccrac
= fgetc(fcrac
)) != EOF
) {
38 if( (corig
= fgetc(forig
)) == EOF
) {
48 printf("\nLenght: %d Bytes", dlen
);
51 printf("\n\n--- END OF OLDER FILE ---\n\n");
55 if(offset
!= (last
+1)) {
57 printf("\nLenght: %d Bytes", dlen
);
61 printf("Difference @ D: %d H: 0x%x\n", offset
, offset
);
64 printf("\\x%x", ccrac
);
75 printf("\nLenght: %d Bytes", dlen
);
82 printf("No difference found!!!");
85 //system("PAUSE"); //Debug
This page took 0.484605 seconds and 4 git commands to generate.