I have written a program that will use the input of a bitmap image file. I have done this in the past in other programming languages, but have come to a stumbling block in C.
Parts of the header, as you probably know are stored as DWORD and WORD data types. In order for my program to function correctly, I need to get these values preferably as an integer to be able to output to the command line.
Right now I want to just output the size of the file. I checked out the 4 bytes that are supposed to have it and it does 0x2E 0x01 0x00 0x00, which in turn is actually 0x0000012E, which is correct. I just want an easy output.
I was wondering if this was a simple task or if I will need to write a routine like I have in the past.
Thanks for your time.
Edit:
If this is the easiest way to do it, just let me know.
Code:int GetDWORD(char data[]) { return ((int)data[0] | ((int)data[1] << 8) | ((int) data[2] << 16) | ((int)data[3] << 24)); }