My code compiles and all 50 image files are created, but if I open them, they're all black. Does anyone know what I'm doing wrong? (Do I need to show my code as well?)

Thanks in advance!

(Code removed: I just had to try it again without changing my code!)

  • Yes, you need to post your code. Otherwise, there's no clue what's happening.
    – Cliff B
    Commented Jun 24, 2016 at 6:46

1 Answer 1


If you run ls -al *.jpg, you would see that every jpeg file is 512 bytes. The code is finding the signatures and copying the signature block out to the new file, but what happens next? The blocks that follow the signature blocks are part of the jpeg image files, but are not being written out to the files. Instead, they're just being discarded.

If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)

  • It passes all the cs50 check tests, but all the photos are still black! Does this mean it's something else than my code that's wrong? (I did fix a few things from the code up there)
    – Hello
    Commented Jun 25, 2016 at 2:20
  • Not psychic. If there's still a code issue, you'd need to post the updated code. However, if you say it passes check50 but still results in black images, here's my question. You updated the code, and ran it through check50. Did you recompile/make a new executable or forget to recompile and reran the old executable? check50 works from the source file, but you would have to recompile to actually execute it locally.
    – Cliff B
    Commented Jun 25, 2016 at 2:37

You must log in to answer this question.

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