New answers tagged

0

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[0] == 0xff && buffer[1] == 0xd8 && buffer[2] == 0xff && (buffer[3] & 0xf0) == 0xe0) { ...


1

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[0],"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 ...


1

It's a subtle but critical error. The problem lies here; int buffer[512]; ... 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 ...


Top 50 recent answers are included