0

My recover.c code "works" in that it recovers the 16 images, but check50 is failing as follows:

https://sandbox.cs50.net/checks/1b832e85fc5148e28a6ae28f24ff9f80

Any idea what that's happening? For reference, here is my code:

https://gist.github.com/RicLouRiv/a76aca2ca07cf819b8a1

Lastly, when I run with gdb, here it the last thing it says after the return 0; block:

__libc_start_main (main=0x80485b0 <main>, argc=1, argv=0xbffff164, init=0x8048800 <__libc_csu_init>, fini=0x8048870 <__libc_csu_fini>, rtld_fini=0xb7fed180 <_dl_fini>, stack_end=0xbffff15c) at libc-start.c:321 321 libc-start.c: No such file or directory.

I'm not sure if that's related, but I thought I'd give more detail than less.

7
  • Hard to guess without knowing more. First, you said that you're getting "expected an exit code of 0, not output of ..." Is that the literal output, or is there something else besides "..." ? Can you post a screen capture of the check50 invocation and result in your question? It looks like check50 is seeing some output it doesn't like. Do you have a stray printf() that's outputting something? Did you remember to close the last output file as well as the input file at the end? As a side note, I did not have a return 0 line in my program at all and it works fine.
    – Cliff B
    Jun 8 '15 at 22:54
  • if you're printfing anything, just don't!
    – kzidane
    Jun 9 '15 at 0:22
  • @CliffB -- if it's easier (and you're amenable to) emailing offline, I would be happy to do that -- and I appreciate the help! I did some other checking like wrapping my fopen and fclose functions with printfs, and making sure my fwrites all equal 1 -- meaning everything divides up and writes nicely.
    – Richard
    Jun 9 '15 at 16:16
  • After looking at your code and running it, I haven't been able to figure out what's happening. Maybe Kareem can find the issue.
    – Cliff B
    Jun 9 '15 at 20:34
  • Well, it's good to know there aren't obvious bugs -- I assume it check50's ok for you? @Kareem, if you have any thoughts, I'm all ears!
    – Richard
    Jun 9 '15 at 20:35
2

I'm pretty sure the grading program will have a problem if you open multiple jpg files. You should open one, write to it, close it, open the next, etc.

3
  • Thank you! I thought the spec said there were 16, but I will fix my code and open files one at a time, per yours and @Kareem's comments.
    – Richard
    Jun 9 '15 at 23:46
  • oh! you are correct. the spec does say 16 (last year's spec didn't have a number, so I didn't realise.) So that bit is fine. :) I will edit my answer.
    – curiouskiwi
    Jun 9 '15 at 23:49
  • I haven't done the rewrite but it should be easy to avoid hard coding 16 if you're opening and closing as you go. :-)
    – Richard
    Jun 9 '15 at 23:52

You must log in to answer this question.

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