Mail Archives: djgpp/1998/01/31/22:47:16
So, could someone tell me, how?
Henri Ossi wrote:
> 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 a byte from a file
> 2)write byte to a file
>
> Char is a word(16bit), right?
> So, fgetch reads a word. But I have to be able to read & write
> a byte.
>
> 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 -