I am having issues with this problem set.

I am unable to recover all 50 pictures, only 49, all of these pictures are not more than a few pixels though. I have seen the whole pictures and there's a lot that I am missing with my solution.


I can't see where I went wrong, but I am a newbie and so I hope someone can help me, I know I must be close :(

  • NVM it was the condition – Rafael Mar 8 '16 at 16:46
  • I've solved it now – Rafael Mar 8 '16 at 16:46
  • Just had to delete some parentheses – Rafael Mar 8 '16 at 16:46
  • Glad you found the problem. It's always good when someone finds their own answer! Can you please post your solution as an answer and (in two days, when the system will allow it) accept your answer so the question will be removed from the unanswered question pool please? Let's keep up on forum maintenance. – Cliff B Mar 8 '16 at 19:34

Sorry, this is the first time I post in stackexchange (I did think of posting the solution but I had to go quickly and so I didn't).

This was the solution (even though I still fail to realise why it wasn't working before, it might be just C syntax)

in lines 35 and 36 I had to replace

if(((buffer[0] = 0xff) && (buffer[1] == 0xd8) && (buffer[2] == 0xff)) && ((buffer[3] == 0xe0) || (buffer[3] == 0xe1))) with

if (buffer[0] == 0xff && buffer[1] == 0xd8 && buffer[2] == 0xff && (buffer[3] == 0xe0 || buffer[3] == 0xe1))

I learnt from an older problem set that I should provide lots of parentheses in order to make everything clear to C, but turns out it actually works better this way, which I also happen to prefer (it's much more readable) thanks

| improve this answer | |
  • Also I can't accept my own answer until tomorrow :P – Rafael Mar 8 '16 at 23:09

You must log in to answer this question.

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