Original Post
I wrote a little program to read pixels from a bmp.
But it isn´t working. The "apply.a.bmp" is a 40x40 8bit bitmap.
on the end it prints "373 byte red".
Where is my fault?
But it isn´t working. The "apply.a.bmp" is a 40x40 8bit bitmap.
int main()
{
FILE *f;
BITMAPINFOHEADER header;
f=fopen("apply.a.bmp","r");
fread(&header,sizeof(header),1,f);
int size = header.biBitCount; //in byte
int i = 0;
void *pixel = malloc(size);
while(feof(f) == 0)
{
i++;
fread(&pixel,sizeof(pixel),1,f);
cout << (int)pixel << endl;
};
cout << i << " byte red" << endl;
fclose(f);
system("pause");
return 0;
}
on the end it prints "373 byte red".
Where is my fault?