Mail Archives: djgpp/1998/01/31/22:47:16

From: Henri Ossi <henri DOT ossi AT mail DOT htk DOT fi>
Newsgroups: comp.os.msdos.djgpp
Subject: Fopen, fgetc, pac_getc etc. problem
Date: Wed, 28 Jan 1998 16:40:05 +0200
Organization: Telecom Finland News Service
Lines: 42
Message-ID: <>
References: <34CC6531 DOT A6869055 AT mail DOT htk DOT fi>
Reply-To: henri DOT ossi AT mail DOT htk DOT fi
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 -

  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019