Reading BMP binary problems.

Hello, i wrote a program which reads binary info from BMP image, it reads the header bytes, RGB bytes, but I cant find the width and height on the image in the header bytes! Can you say wrehe those values are hidden?
The Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <iostream>
#include <fstream>

using namespace std;

ifstream inp;

int main()
{
    inp.open("bmp2.bmp");

    unsigned char foo;
    int i=0;

    if(!inp.is_open()) return -1;

    while(!inp.eof())
    {
        inp>>foo;

        cout<<(int)foo<<" ";

        i++;
    }
    cout<<"\n\n"<<i;

    return 0;
}
http://en.wikipedia.org/wiki/BMP_file_format
Width and height starting from 18 byte. 4 bytes each.
Yeah, i read it byte by byte, and i should have read 4 bytes
Topic archived. No new replies allowed.