reading bitmap into array
I have a question regarding reading a bitmap image into an array. I understand that usually the first 54 bytes of the bitmap is for the header information, and basically I need to be able to read the whole image into the array, alter the non-header parts to encrypt the image and and write the array back out into a new bitmap image. I'm not sure how to extract the height and width information nor how the reading of the bytes to an array works.
For example, I have
Code:
typedef struct {
char* data;
char* header;
int height;
int width;
int size;
} Bitmap;
and I want to be able to do this
Code:
/* The following function takes a file name and an address of
a character array and read the file of characters into the
array. Array and size are passed by their addresses
Reads the BMP image from a file to an array
*/
void readImage(char* infile, Bitmap *bitmap){
FILE * input = fopen(infile, "br");
}
Currently I'm a little clueless and have only gotten as far as opening the file in binary, can anyone give me a few hints as to how I go about this? Thanks a lot in advance.