resize program works for some and not others : > so the problem, is suppose to take 3 arguments (factor, infile and outfile) the factor is a positive integer from 1 - 100. the program then is suppose to resize the infile image depending on the factor, 1 produce the same image and 2 twice as big and so on to the outfile.
currently my program does this succesfully for some images and only on certain scale factors.
when i run it through my courses ide check program for this question the errors i recieve are;
**:) resize.c and bmp.h exist.
:) resize.c compiles.

:) doesn't resize small.bmp when n is 1

:( resizes small.bmp correctly when n is 2
Byte 34 of pixel data doesn't match. Expected 0xff, not 0x00

:( resizes small.bmp correctly when n is 3
Byte 48 of pixel data doesn't match. Expected 0xff, not 0x00

:( resizes small.bmp correctly when n is 4
Byte 62 of pixel data doesn't match. Expected 0xff, not 0x00

:( resizes small.bmp correctly when n is 5
Byte 80 of pixel data doesn't match. Expected 0xff, not 0x00

:) resizes large.bmp correctly when n is 2

:) resizes smiley.bmp correctly when n is 2**
```C
// Copies a BMP file and resizes it

#include <stdio.h>
#include <stdlib.h>
#include "bmp.h"

int main(int argc, char *argv[])
{
    // ensure proper usage
    if (argc != 4)
    {
        fprintf(stderr, "Usage: ./resize factor infile outfile\n");
        return 1;
    }
    // Check argument 1 to see if integer within aceptable range
    int factor = atoi(argv[1]);
    if (factor <= 0 || factor > 100)
    {
        fprintf(stderr, "Must be a positive integer greater than 0 and eqaul or less than 100\n");
        return 1;
    }

    // remember filenames
    char *infile = argv[2];
    char *outfile = argv[3];

    // open input file
    FILE *inptr = fopen(infile, "r");
    if (inptr == NULL)
    {
        fprintf(stderr, "Could not open %s.\n", infile);
        return 2;
    }

    // open output file
    FILE *outptr = fopen(outfile, "w");
    if (outptr == NULL)
    {
        fclose(inptr);
        fprintf(stderr, "Could not create %s.\n", outfile);
        return 3;
    }


    // read infile's BITMAPFILEHEADER
    BITMAPFILEHEADER bf;
    BITMAPFILEHEADER bf_New;
    fread(&bf, sizeof(BITMAPFILEHEADER), 1, inptr);
    bf_New = bf;

    // read infile's BITMAPINFOHEADER
    BITMAPINFOHEADER bi;
    BITMAPINFOHEADER bi_New;
    fread(&bi, sizeof(BITMAPINFOHEADER), 1, inptr);
    bi_New = bi;

    // ensure infile is (likely) a 24-bit uncompressed BMP 4.0
    if (bf.bfType != 0x4d42 || bf.bfOffBits != 54 || bi.biSize != 40 ||
        bi.biBitCount != 24 || bi.biCompression != 0)
    {
        fclose(outptr);
        fclose(inptr);
        fprintf(stderr, "Unsupported file format.\n");
        return 4;
    }

    // set new height and width of BMP
    bi_New.biHeight = bi.biHeight * factor;
    bi_New.biWidth = bi.biWidth * factor;

    // calculate padding for old file and new file
    int padding = (4 - (bi.biWidth * sizeof(RGBTRIPLE)) % 4) % 4;
    int padding_New = (4 - (bi_New.biWidth * sizeof(RGBTRIPLE)) % 4) % 4;

    // set the file size for the new file
    bi_New.biSizeImage = (bi_New.biWidth * sizeof(RGBTRIPLE) + padding_New) * abs(bi_New.biHeight);
    bf_New.bfSize = bi_New.biSizeImage + sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER);


    // write outfile's BITMAPFILEHEADER
    fwrite(&bf_New, sizeof(BITMAPFILEHEADER), 1, outptr);

    // write outfile's BITMAPINFOHEADER
    fwrite(&bi_New, sizeof(BITMAPINFOHEADER), 1, outptr);

    // iterate over infile's scanlines
    for (int i = 0, biHeight = abs(bi.biHeight); i < biHeight; i++)
        {
            // itterate factor times
            for (int k = 0; k < factor; 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);

                    // iterate over horizontal pixels
                    for (int l = 0; l < factor; l++)
                    {
                        // write RGB triple to outfile itterate the same pixel by factor times
                        fwrite(&triple, sizeof(RGBTRIPLE), 1, outptr);
                    }
                }

                // skip over padding, if any
                fseek(inptr, padding, SEEK_CUR);

                // add new padding
                for (int m = 0; m < padding_New; m++)
                {
                    fputc(0x00, outptr);
                }

                // seek back to the beginning of row in input file, but not after iteration of printing
                if (k + 1 < factor )
                {
                    fseek(inptr, -(bi.biWidth * sizeof(RGBTRIPLE)), SEEK_CUR);
                }
            }


        }

    // close infile
    fclose(inptr);

    // close outfile
    fclose(outptr);

    // success
    return 0;
}
```