Mail Archives: djgpp/1997/09/10/15:22:45
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 -