New answers tagged

0

I copy-pasted your code on CS50 IDE and used the debugger. The first 512-bytes block is not a JPEG so I go to line 51 (after the else) and test outfile==NULL. You can see that the pointer to the outfile is NULL so it makes sense that your program is entering the if statement and printing "No Output File 2". You are using the correct functions but ...


0

Look at the following code: else { if (outfile == NULL) { printf("%s\n", "No Output File 2"); return 1; } fwrite(buffer, 512, 1, outfile); } Now, remember what the pset spec said. The data at the beginning of the input file is garbage and needs to be discarded. That ...


Top 50 recent answers are included