I'm on pset4/resize now and got an issue, my code works properly but can't pass check50. I used ~cs50/pset4/peek to check the header, it's all the same with the staff's implementation. I even created an 1x1 pixel bitmap image to check, and my code still worked well resizing it to 2x2, 3x3, 5x5 pixel bitmap image. Please help!
// iterate over infile's scanlines
for (int i = 0, biHeight = abs(bi.biHeight); i < biHeight; i++)
{
for (int q = 0; q < n; q++)
{
// iterate over pixels in scanline
for (int j = 0; j < bi.biWidth; j++)
{
// temporary storage
RGBTRIPLE triple;
// read RGB triple from infile
fread(&triple, sizeof(RGBTRIPLE), 1, inptr);
for (int k = 0; k < n; k++)
// write RGB triple to outfile
{
fwrite(&triple, sizeof(RGBTRIPLE), 1, outptr);
}
}
// add padding
for (int k = 0; k < paddingR; k++)
{
fputc(0x00, outptr);
}
// take the cursor back to the beginning of the scanline
if (q < n-1)
{
fseek(inptr, -(bi.biWidth * sizeof(RGBTRIPLE)), SEEK_CUR);
}
}
// skip over padding, if any
fseek(inptr, padding, SEEK_CUR);
}
// close infile
fclose(inptr);
// close outfile
fclose(outptr);
// that's all folks
return 0;