Ive just got to pset4 and it seems a bit of a jump from pset3, I'm trying to understand how everything works before diving into the problem.
This loop in my mind which is copying the bmp files goes over every pixel and copies it to the new file. To me it seems that in the fread and fwrite functions 3 arguments &triple, 1, inptr/outptr are constant.However i just don't see how the sizeof(RGBTRIPLE) is changing value in this loop, as 'i' and 'j' don't seem to interact with it.
for (int i = 0, biHeight = abs(bi.biHeight); i < biHeight; i++)
{
// 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);
// write RGB triple to outfile
fwrite(&triple, sizeof(RGBTRIPLE), 1, outptr);
}
// skip over padding, if any
fseek(inptr, padding, SEEK_CUR);
// then add it back (to demonstrate how)
for (int k = 0; k < padding; k++)
{
fputc(0x00, outptr);
}
}