0

[solution code removed]

) resize.c and bmp.h exist.
:) resize.c compiles.
:( doesn't resize small.bmp when n is 1
    Header field bfSize doesn't match. Expected 0x5a, not 0x48
:( resizes small.bmp correctly when n is 2
    Header field bfSize doesn't match. Expected 0xae, not 0x54
:( resizes small.bmp correctly when n is 3
    Header field bfSize doesn't match. Expected 0x132, not 0x5a
:( resizes small.bmp correctly when n is 4
    Header field bfSize doesn't match. Expected 0x1e6, not 0x5a
:( resizes small.bmp correctly when n is 5
    Header field bfSize doesn't match. Expected 0x306, not 0x90
:( resizes large.bmp correctly when n is 2
    Header field bfSize doesn't match. Expected 0x6f6, not 0x7e
:( resizes smiley.bmp correctly when n is 2
    Header field bfSize doesn't match. Expected 0x336, not 0x66
:( resizes smiley.bmp correctly when n is 3
    Header field bfSize doesn't match. Expected 0x6f6, not 0x7e
See https://cs50.me/ch
0
bi.biSizeImage = ((3 * bi.biWidth) + padding *abs(bi.biHeight));

Think about parentheses and operator precedence. This is multiplying ONLY padding times biHeight and adding that to 3*biWidth.

My guess is that check50 is checking bfSize before biSizeImage.

Of course, checking headers with the peek and xxd tools would reveal that there's more than one problem. ;-)

If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .