I'm thinking you got a little confused when you were writing this part. Note that I added comments, "LINE A" and "LINE B":
// char for the write
char writeFile[count * sizeof(buffer)]; // LINE A
if (buffer == 0xff && buffer == 0xd8 && buffer == 0xff && (buffer & 0xf0) == 0xe0)
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 ...
It's a subtle but critical error. The problem lies here;
for(int i = 0; i < 512; i++)
fread(&buffer[i], 1, 1, raw);
Here's what's happening. The fread() call reads exactly one byte and stores it in one element of the buffer array. But, each element in the array is 4 bytes long! The remaining bytes are ...