Mail Archives: djgpp/1998/01/30/01:46:12
Hi.
I've made a fractal program, and It can produce 24bit images on the
screen (cool :)
Now I'm planning to make it save the image to a .TGA file.
I downloaded the TGA file specification, but I have one problem.
How can I
1)read 8bits from a file
2)write 8bits to a file
Char is 16bit long, right?
So, fgetch reads 16bits (word), but I have to be able to read & write
8bits.
How is this done?
I looked from the source code of allegro, and there the TGA file reader
was using "pack_getc()" -function
to get bytes from the packet file, but I coudln't find the code of the
function.
I've been thinking about this kind of solution, could it work?
c = "read the word from the file";
byte1 = c >> 8;
byte2 = (c <<8)>>8;
But I still can't write bytes with that one...
Thanks for your answers.
-Henri Ossi
- Raw text -