I am having trouble with recover from pset4 - when I run it, it creates 50 images, apparently correctly formatted (000.jpg-049.jpg). However, check50 rejects it:

:) recover.c exists.
:) recover.c compiles.
:) handles lack of forensic image
:( recovers 000.jpg correctly
    000.jpg not found
:( recovers middle images correctly
    001.jpg not found
:( recovers 049.jpg correctly
    049.jpg not found

Here is my implementation:

 * recover.c
 * Computer Science 50
 * Problem Set 4
 * Recovers JPEGs from a forensic image.
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>

            sprintf(str, "%.3d.jpeg", t);

[EDIT: unrelated code removed for Honor Code compliance.]


Prepare for a painful self-headslap. ;-)

File names are important. The code created 50 files with the extension .jpeg. The spec said to create files using the extension .jpg, without the "e". Guess what's happening. ;-)

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

  • Owww. I noticed you removed a tag, what is the reason? I am (obviously) new to platform, please forgive my lack of knowledge. :) Nov 8 '18 at 3:37
  • We have a lot of tags here, some are redundant. I'm just trying to clean things up a bit. pset4recover is covered by pset4 and recover. But that's just my opinion, I could be wrong. ;-) Don't feel offended or anything, it's no big deal, just trying to do some housekeeping.
    – Cliff B
    Nov 8 '18 at 3:45

You must log in to answer this question.

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