Quote:
Originally Posted by Salem
A breakpoint on the fwrite call would be a start.
Then examine the variables in detail.
|
That was how I found the line where the problem occurred.
Quote:
Originally Posted by Salem
> this only happens when the bitmap is less than 4x4 pixels in size!
Are you taking into account the various ways in which bitmap data is padded/aligned to 4-byte boundaries.
|
More or less. I'm reading in the bitmaps as a whole, based on the header information. I did a separate test on my bitmap library to see if the read function was causing the problem, and it's not. My test app reads in the same 1x1 256bpp bitmap and divulges the necessary info perfectly.
This problem is... very odd. The BMPPKGFILE pointer passed to the WriteBmpPkgFile is correct, and the data in the memory it points to is also correct.
And fwrite even fails if I do this instead:
DWORD dwcount = lpBmpPkg->dwCount;
// write the dwCount member
fwrite(&dwcount, sizeof(DWORD), 1, outfile);
And this:
DWORD dwcount = 0x01; //lpBmpPkg->dwCount;
// write the dwCount member
fwrite(&dwcount, sizeof(DWORD), 1, outfile);
Strange, no?