How does the structs declared in 'bmp.h' know which bytes to get the data from?
The resize program works with the BMP file format which has a few characteristics which need to be altered, namely headers containing information about the data and padding.
Supporting this notion, there are a few structures created beforehand in bmp.h. They are simply ...
fread does really tell the computer where to start getting the data:
// read infile's BITMAPFILEHEADER
fread(&bf, sizeof(BITMAPFILEHEADER), 1, inptr);
// read infile's BITMAPINFOHEADER
fread(&bi, sizeof(BITMAPINFOHEADER), 1, inptr);
The first fread reads sizeof(BITMAPFILEHEADER) bytes from the beginning of ...
The problems revolve around how the pointer is moved at the end of each line in the input file and how padding is added to the output file. There are two issues.
First, the output file padding. It works for n=1 because the padding sizes are identical. The problem here is that the code is writing the input padding to the output file.
Next, when handling ...
I really don't understand it very well myself but i am going to try explain it.
It is all related to the way this values are stored in the memory, RAM, hard drives, ..., integers, decimal numbers, hexadecimal numbers, ascii characters and more, at the end all are converted to binary in order to be stored in memory, only 0's and 1's.
The ascii ...
It can't be bfType = 0x424d because that is a completely different
Yes, it would surely be a different value if it was interpreted as a whole and compared it with each of the 0x42 and 0x4d separately. But what technically happens is something like this
/* imagine this is the memory */
b0 b1 b2 b4 ...