Hot answers tagged

2

(already answered on reddit, just for this question to have an answer) Instead of fwrite(&pixel, sizeof(RGBTRIPLE), 1, outptr); use fwrite(&pixel[hor], sizeof(RGBTRIPLE), 1, outptr); or equivalently fwrite(pixel + hor, sizeof(RGBTRIPLE), 1, outptr); &pixel[hor] and pixel + hor both represent the memory address of the horth element of pixel....


2

As you know arrays start with index 0. it means name of outfile should be char *outfile = argv[3]; , not argv[4].


1

I see two problems with your code. Both are here: if (fread(buffer, 512, 1, file) != 512) { fclose(jf); n++; } First, if the fread works correctly, it will return 1 here, not 512. The value returned is the number of elements returned. The third parameter tells how many elements to read, ...


1

Per the advice on the front page of the course, if you completed problem set 3 in 2018, you need to start with 2019 Week 3 (and 2019 problem set 3). 2019 pset3 is whodunit/resize/recover. I'm going to assume that if you said you did 2 out of 3 of pset4-2018, you did whodunit and resize; if that's correct, then you need to complete Recover (https://docs....


1

Two things in the scale down code seem odd to me. Your loop for (int i = 0, biHeight = abs(bi.biHeight); i < biHeight; i++) with the fseek at the end. You skip lines in the input file, but that does not reflect in the loop code. This explains the extra lines you see, with full padding at the end. Either use the output height instead of input height, or ...


Only top voted, non community-wiki answers of a minimum length are eligible