delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/09/10/15:22:45

From: Shawn Hargreaves <Shawn AT talula DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: File/Allegro problem
Date: Wed, 10 Sep 1997 18:52:03 +0100
Organization: None
Distribution: world
Message-ID: <pIIJmBAD5tF0Ew1z@talula.demon.co.uk>
References: <34166E67 DOT 5DD9 AT bc DOT sympatico DOT ca>
NNTP-Posting-Host: talula.demon.co.uk
MIME-Version: 1.0
Lines: 20
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Ryan Blazecka writes:
>When writing out a whole bunch of values to a file using fputc or
>Allegro's pack_iputl, should I check the return value from each one, or
>just write them all, and check only the return value from the last one?

I hope you aren't trying to mix those two functions! fputc() is a stdio
routine, while pack_iputl() uses the Allegro file compression code, and
the two don't mix well :-)

But anways. The easiest approach to detecting errors is to write out the
entire file and then check the return code from pack_ferror() or the
value of the global variable errno once you are done. Both stdio and the
Allegro code will give up gracefully if you go on writing data after an
error occurs, so it simplifies things greatly if you only do one check
at the end of the operation...


--
Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
Beauty is a French phonetic corruption of a short cloth neck ornament.

- Raw text -


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