stdint.h
is a header file for instroducing more integer datatypes which allows to be more precise as to what width the datatype
can be, for example, integer can be unsigned, signed with size of width 8 bits, 16, 32, and maximum up to 64 bits.
This are the C/C++ aliases of primitive data types that map to data types used in Windows programming like BYTE
, DWORD
, LONG
, and WORD
.
BYTE
: 1 byteDWORD
: 4 bytesLONG
: 4 bytesWORD
: 2 bytes
What (in ASCII, decimal, or hexadecimal) must the first two bytes of any BMP file be? Leading bytes used to identify file formats (with high probability) are generally called "magic numbers."
First two bytes are: 0x4d42
.
bfSize
is total size of FILE in bytes, whereas biSize
is total number of bytes required by the structure.
If biHeight
is positive, the bitmap is a bottom-up DIB and its origin is the lower-left corner.
If biHeight
is negative, the bitmap is a top-down DIB and its origin is the upper-left corner.
biBitCount
(number of bits-per-pixel) field in the BITMAPINFOHEADER
struct determines the number of bits that define each pixel and the maximum number of colors in the bitmap.
fopen
can return NULL
if OS cannot open the file with given permission and type of mode, or filepath is invalid,
or file is write-protected, in those cases fopen
will return the NULL
pointer.
Because there's only one file and info header, and we read and write one RGBTRIPLE at a time.
fseek
is file position indicator which jumps over to offset specified from
designated position - i.e. current position, beginning of file or end of file.
SEEK_CUR
: is the current position in file.
It was Professor Plum with the Candlestick in the library.