hi guys again!
i want to read a bitmap in this way:
please help me!! how can i read the pixels of a bitmap??
#include <iostream>
#include <fstream>
#include <conio.h>
using namespace std;
struct bitmap{
int pixel;
int black;
int white;
};
int main(){
bitmap b[400];
ifstream a("a.bmp",ios::binary);
int i=0;
while(i<400){
a.read((char *)&b[i].pixel,24);
i++;
}
i=0;
int x=0;
while(i<400){
cout<<b[i].pixel;
x++;
if(x==20)
cout<<endl;
i++;
}
getch();
return 0;
}
just replace your own 24-bit bitmap and see the reasult!
is it working?