A simple question

Hello, I’ve a simple question. I’m going through some code related with writing a bmp image file.

In the following code, what does ‘filesize>>8’ imply? How is it used in a bmp file?

bmpfileheader[ 2] = (unsigned char)(filesize );
bmpfileheader[ 3] = (unsigned char)(filesize>> 8);
bmpfileheader[ 4] = (unsigned char)(filesize>>16);
bmpfileheader[ 5] = (unsigned char)(filesize>>24);

Thanks.

I understand, this is just offset in the bmp file header.

The file size in the image is little endian. This code stores the integer as little endian irregardless of the
machines actual endianness.

The code assumes that a character has 8 bits. The first line extracts the first byte of the integer, the
second line the next higher byte (shifting it to the right by 8 bits and cutting the rest off), the third line
the next higher bytes (shifting it right by 16, cutting the rest of) and the last line extracts the highest
byte.