hey guys i need some help.i need to get rgb from bmp file
my problem: when i get the colors my output is CDCDCD32,CDCDCD84,CDCDCDF9
i need to get
32,84,F9
how can i move the bite?
my code is :
Code:
int bitmapin(FILE* fp, int height, int width,  pixel** img) {	long n;
	int t;
	fseek(fp, 10, SEEK_SET);
	fread(&t, 1, 4, fp);     //reads the offset and puts it in t
	fseek(fp, t, SEEK_SET);
	int i, p, e;
	e = 4 - ((height * 3) % 4);
	if (e == 4) {
		e = 0;
	}
	for (i = height - 1; i >= 0; i--) {
		for (p = 0; p < width; p++) {
			n = fread(&img[i][p].blue, 1, 1, fp);
			if (n != 1) {
				return 29;
			}
			n = fread(&img[i][p].green, 1, 1, fp);
			if (n != 1) {
				return 30;
			}
			n = fread(&img[i][p].red, 1, 1, fp);
			if (n != 1) {
				return 31;
			}
		}
		fseek(fp, e, SEEK_CUR);
	}
	printf("%X,%X,%X",img[1][1].red, img[1][1].green, img[1][1].blue);
	return 0;
}
Code:
typedef struct {
	int blue;
	int green;
	int red;
} pixel;
Code:
pixel** make2Dpixelarray(int Y, int X) {	pixel** theArray;
	theArray = (pixel**)malloc(X * sizeof(pixel*));
	for (int i = 0; i < X; i++) {
		theArray[i] = (pixel*)malloc(Y * sizeof(pixel));
	}
	return theArray;
}