N
Nhwk
I have an unsigned char banner[96], which contains data for a 12x8
bitmap file.
I am attempting to construct and write to disk a .bmp file with this
data.
So far, I started by constructing the required .bmp header, by doing
the following..
char b[57];
b[0] = 0x42;
b[1] = 0x4D;
b[2] = 0x98;
b[3] = 0x04;
etc, and have verified I have the correct header and palette info by
using a hex editor to compare my output file to a valid .bmp file.
Now here's my problem: I'm not quite sure how to append the unsigned
chars (p->banner) to the file after i write b.
std:fstream bDump;
bDump.open("bannerdump.bmp", std::ios:ut | std::ios::binary);
bDump.write((char*)&b, 58);
bDump.write((char*)&p->banner, 96);
bDump.close();
However this doesn't work, as it doesn't seem to add enough data to
the file as compared to the valid file when I view them in a hext
editor. Casting the unsigned char to a (char*) seems kind of wrong.
Can anyone give me any pointers?
bitmap file.
I am attempting to construct and write to disk a .bmp file with this
data.
So far, I started by constructing the required .bmp header, by doing
the following..
char b[57];
b[0] = 0x42;
b[1] = 0x4D;
b[2] = 0x98;
b[3] = 0x04;
etc, and have verified I have the correct header and palette info by
using a hex editor to compare my output file to a valid .bmp file.
Now here's my problem: I'm not quite sure how to append the unsigned
chars (p->banner) to the file after i write b.
std:fstream bDump;
bDump.open("bannerdump.bmp", std::ios:ut | std::ios::binary);
bDump.write((char*)&b, 58);
bDump.write((char*)&p->banner, 96);
bDump.close();
However this doesn't work, as it doesn't seem to add enough data to
the file as compared to the valid file when I view them in a hext
editor. Casting the unsigned char to a (char*) seems kind of wrong.
Can anyone give me any pointers?