It's failing because the program is terminating abnormally, even though it is creating the output files. When I run it, I get this, along with the recovered images:
~/go/test/pset4/jpg/ $ ./recover card.raw
munmap_chunk(): invalid pointer
This causes the tests to fail. The problem lies with this code:
Neither of these ...
If the second, or any odd-indexed candidate, is the winner print_winner will not detect that. Why?
The i for loop in vote only processes the even indexes because i is incremented twice: once in the loop itself and once in the else clause. Incrementing the for variable within the loop is very often a bug waiting to happen.
If you run the Usage Election but ...
Actually, it's not working correctly. There's an infinite loop. It may look like it's working fine on your IDE, but try checking the file size of 049.jpg. It's growing without bound. I suspect your IDE is terminating the program when the disk space is being used up.
Take a close look at the code related to handling the EOF for the input file.
The screen shot would be easier to read if larger, or simply pasted text. It says:
cannot open file cash: Is a directory.
If if the full path to the file being compiled should be pset1/cash/cache.c, but it is actually pset1/cash.c, the presence of a directory called 'cash' will cause that error. Try running 'pwd' and 'ls' yourself. If you see this: