Program is not producing any jpgs because it is reading itself. Recall from the lecture the first element in argv is the program's name, so the problem is here.
FILE *card = fopen(argv,"r");
From the spec:
Thanks to FAT, you can trust that JPEGs’ signatures will be “block-aligned.” That is, you need only look for those signatures in a block’s ...