Skip to content

Latest commit

Β 

History

History
52 lines (28 loc) Β· 1.85 KB

README.md

File metadata and controls

52 lines (28 loc) Β· 1.85 KB

Questions

What's stdint.h?

The <stdint.h> header shall declare sets of integer types having specified widths, and shall define corresponding sets of macros. It shall also define macros that specify limits of integer types corresponding to types defined in other standard headers.

What's the point of using uint8_t, uint32_t, int32_t, and uint16_t in a program?

Preserve the correct numerical values of various properties according and to the protocol.

How many bytes is a BYTE, a DWORD, a LONG, and a WORD, respectively?

BYTE = 1 byte DWORD = 4 bytes LONG = 4 bytes WORD = 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."

0x4d42

What's the difference between bfSize and biSize?

bfSize = The size, in bytes, of the bitmap file.

What does it mean if biHeight is negative?

If biHeight is negative, the bitmap is a top-down DIB and its origin is the upper-left corner.

What field in BITMAPINFOHEADER specifies the BMP's color depth (i.e., bits per pixel)?

biBitCount

Why might fopen return NULL in lines 24 and 32 of copy.c?

Because the OS may fail to open the given file for various reasons such as passing in a filename of non-existent file.

Why is the third argument to fread always 1 in our code?

Because there's only one file header and info header sizeof() returns the number of bytes necessary to store the entire structure.

What value does line 63 of copy.c assign to padding if bi.biWidth is 3?

3

What does fseek do?

Sets the file position indicator for the file stream stream to the value pointed to by offset.

What is SEEK_CUR?

It's a flag that determines the originating position of the fseek file operation.