0

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!)

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

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. ;-)

2
  • 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
    Jun 25 '16 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
    Jun 25 '16 at 2:37

You must log in to answer this question.

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