In the whodunit assignment, when I used the copy.c given in the pset4.zip on smiley.bmp and executed the diff check, there was no message shown. However, when I used the copy.c and diff on the clue.bmp, it gave me the message "Binary files clue.bmp and verdict.bmp differ." Could someone tell me what I'm doing wrong?

Thanks so much

  • so you created a copy from clue.bmp and named it verdict.bmp using copy and diff says the two copies are different?
    – kzidane
    Jul 4 '15 at 4:42
  • yep, but I see they are both 922KB Jul 4 '15 at 4:45
  • having the same size doesn't necessarily mean that the data is the same. did you by any chance modify copy.c and recompiled the program?
    – kzidane
    Jul 4 '15 at 4:55
  • nope i didn't modify copy.c Jul 4 '15 at 4:58
  • yeah actually diff doesn't say two files are different unless they truly are. so just to be absolutely sure about what you did, did you execute ./copy clue.bmp verdict.bmp then diff clue.bmp verdict.bmp and diff said they were different?
    – kzidane
    Jul 4 '15 at 5:02

I just checked and apparently this is the answer. that is, the program that was used to create clue.bmp added 2 bytes at the end of the file. copy.c does not assume there are any additional bytes other than the BMP itself (i.e., the headers and the image).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .