and thanks for helping me with my problem. I have managed to get horizontal resizing to work within my resizing program, but every time I attempt the next step, I keep failing. Here is the code of the main loop of the program:
// iterate over infile's scanlines
for (int i = 0, biHeight = abs(bi.biHeight); i < biHeight; i++)
{
// Perform the horizontal resize many times to get a vertical one.
for (int k = 0; k < factorint; k++)
{
// 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 to file the amount of times for the scale factor.
for (int l = 0; l < factorint; l++)
{
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);
}
}
// Tries to return to beginning of line, but fails.
fseek(inptr, bi.biWidth, SEEK_CUR);
}
The problem, I believe, is when I try to return the input file position to the start of the line - every time I try, it results in a garbled mess. I know that is what I need to do, but every time I attempt this, I fail. Could anyone give any pointers to help me? Thanks in advance for your suggestions, and I am sorry if have asked a stupid question.