Hi All.

I need to read an image to char array with C++. I have written the following code for it, but it seems that the code does not read the entire image, it just reads the part of it. Can someone hint why, or give some better solution for how to read an image into char array?

std::fstream image;
image.open("C:\\bbb.bmp");

image.seekg (0, ios::end);
int n = image.tellg();
image.seekg (0, ios::beg);

char* res = new char[n];

image.read(res, n);

Thanks behorehand.