I am trying to read a bmp file using fstream. However, it skips values ββbetween 08 and 0E (hex), for example, for values ββ42 4d 8a 16 0b 00 00 00 00 36
he reads
42 4d 8a 16 00 00 00 00 36
skip 0b as it doesn't exist at all in the document.
What to do?
the code:
ifstream in;
in.open("ben.bmp", ios::binary);
unsigned char a='\0';
ofstream f("s.txt");
while(!in.eof())
{
in>>a;
f<<a;
}
EDIT: using in.read(a,1);instead in>>a;solves the reading problem, but I need to write unsigned characters, and f.write(a,1);not accept unsigned characters. Has anyone got a function for writing with unsigned characters?
source
share