I'm trying to read a .bmp file. I succesfully read the initial B and M characters, but after that i get only 0, if wrote into an integer or blanks, if wrote into a char. According to https://en.wikipedia.org/wiki/BMP_file_format there should be the size of the file, some reserved Bytes and the Offset of my file.
int main(){
std::ifstream file("bmp.bmp");
char token;
int num;
file >> token;
if(token != 'B')
std::cerr << "file is not a .bmp";
file >> token;
if(token != 'M')
std::cerr << "file is not a .bmp";
for(int i = 0; i < 3; i++){
file >> num;
std::cout << num << "\n;
}
file.close
}
All this Code will print on the consol is:
0
0
0
Why am i not getting the expected Output?