Reading out Colorvalues (OpenIL)

Hi!
I want to read out the colorvlaues of the pixels on a bitmap loaded with OpenIL/DevIL -Lib…But it really doesn´t work. Here´s my code:

ilGenImages(1, &BitmapID);
ilBindImage(BitmapID);

ilLoadImage(“bitmap.bmp”);
ilGetInteger(IL_IMAGE_WIDTH);
ilGetInteger(IL_IMAGE_HEIGHT);

ILubyte *cData = ilGetData();

int bytes_pp = ilGetInteger(IL_IMAGE_BYTES_PER_PIXEL);

int i_max=ilGetInteger(IL_IMAGE_WIDTH)*ilGetInteger(IL_IMAGE_WIDTH)*bytes_pp;

for(int i=0;i<i_max-bytes_pp;i++)
{
int t_i=i/bytes_pp;

  	color_map[t_i].r = cData[i+0];
  	color_map[t_i].g = cData[i+1];
  	color_map[t_i].b = cData[i+2];

}

Ok, no compiler-errors, no runtime errors, but the colorvalues aren´t correctly saved to my variables…
What´s wrong with it???

[This message has been edited by TheBlob (edited 01-28-2002).]

[This message has been edited by TheBlob (edited 01-28-2002).]