Please, as I wrote, I tried both for long integer in fseek but still I have the unsigned integer overflow message. Can u help me pls ? tsk here the code :
// data increase by the n value for enhance
BITMAPFILEHEADER bf_n;
BITMAPINFOHEADER bi_n;
bf_n = bf;
bi_n = bi;
// dimensions from enhance with n size for bitmapinfoheader
bi_n.biWidth = n * bi.biWidth;
bi_n.biHeight = n * bi.biHeight;
// write outfile's BITMAPFILEHEADER
fwrite(&bf_n, sizeof(BITMAPFILEHEADER), 1, outptr);
// write outfile's BITMAPINFOHEADER
fwrite(&bi_n, sizeof(BITMAPINFOHEADER), 1, outptr);
// determine padding for scanlines
int padding_new = (4 - (bi_n.biWidth * sizeof(RGBTRIPLE)) %4) %4;
int padding = (4 - (bi.biWidth * sizeof(RGBTRIPLE)) % 4) % 4;
//new dimension of biSizeImage
//bi_n.biSizeImage = bi_n.biWidth * bi_n.biHeight;
//bf_n.bfSize = 54 + bi_n.biSizeImage + padding_new;
bf_n.bfSize = 54 + (bi_n.biWidth * sizeof(RGBTRIPLE) + padding_new) * bi_n.biHeight;
bi_n.biSizeImage = bf_n.bfSize - 54;
// iterate over infile's scanlines
for (int i = 0, biHeight = abs(bi.biHeight); i < biHeight; i++) // abs means positive value
{
// each row will be copy until n number enhance
for (int j = 0; j <= n; j++)
{
for (int g = 0; g < bi.biWidth; g++)
{
// temporary storage
RGBTRIPLE triple;
// read RGB triple from infile
fread(&triple, sizeof(RGBTRIPLE), 1, inptr);
// each RGB triple copy until n number for enhance
for (int z = 0; z <= n; z++)
{
fwrite(&triple, sizeof(RGBTRIPLE), 1, outptr);
}
// add new padding to outfile (to demonstrate how
for (int k = 0; k < padding_new; k++)
{
fputc(0x00, outptr);
}
if ( j < n - 1)
{
//seek back to the beggining of the row in input file
fseek(inptr, -(long int)(bi.biWidth*sizeof(RGBTRIPLE) + padding), SEEK_CUR);
}
//skip over padding if any
fseek(inptr, padding, SEEK_CUR);
}
}
}
// close infile
fclose(inptr);
// close outfile
fclose(outptr);
// success
return 0;
}