podoboq
asked on
ifstream::operator>> problem
im trying to read width and height property of a BMP image file like:
ifstream bmp(file_name.c_str(), ios::binary);
if(!bmp) throw string("unable to open " + file_name + "!");
unsigned int width( 0), height(0);
bmp.seekg(18); //move to width/height position
bmp >> width;
bmp >> height;
just nothing happens, though reading chars is okay. isnt ifstream::operator>> supposed to deal with ints also(like istream does)? dont want to use the ugly ifstream::read(...)
ifstream bmp(file_name.c_str(), ios::binary);
if(!bmp) throw string("unable to open " + file_name + "!");
unsigned int width( 0), height(0);
bmp.seekg(18); //move to width/height position
bmp >> width;
bmp >> height;
just nothing happens, though reading chars is okay. isnt ifstream::operator>> supposed to deal with ints also(like istream does)? dont want to use the ugly ifstream::read(...)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Regards, Alex