Reading BMP file C++ (trouble with reading BMP header)
问题 I am trying to write BMP image class with reading method. I saw msdn specification of BMP files, so I try to read the headers and after, using the biHeight and biWidth information, read RGB info of every pixel. So, it don't read header information, the value of every header parameter is -1. Here's code: #ifndef BMP_IMAGE_H #define BMP_IMAGE_H #include <fstream> using namespace std; typedef struct { unsigned int bfType; unsigned long bfSize; unsigned int bfReserved1; unsigned int bfReserved2;