Xref: utzoo comp.sys.amiga:34657 comp.lang.c:19054 Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!iuvax!bsu-cs!dhesi From: dhesi@bsu-cs.bsu.edu (Rahul Dhesi) Newsgroups: comp.sys.amiga,comp.lang.c Subject: Re: C problems Keywords: Amiga, Manx 3.6a Message-ID: <7511@bsu-cs.bsu.edu> Date: 31 May 89 04:51:08 GMT References: <365@xdos.UUCP> Reply-To: dhesi@bsu-cs.bsu.edu (Rahul Dhesi) Followup-To: comp.lang.c Organization: CS Dept, Ball St U, Muncie, Indiana Lines: 23 In article <365@xdos.UUCP> doug@xdos.UUCP (Doug Merritt) writes: > putc(c, fp2); and > fclose(fp1); May I respectfully suggest error-checking: if (putc(c, fp2) == EOF) ... handle error ... And yes, even fclose! if (fclose(fp1) == EOF) ... handle error ... It seems like overkill, but not detecting a full device is a *very* common bug in C programs. (However, a possible optimization is to call ferror() just once before the output stream is closed instead of testing the value from putc all the time.) -- Rahul Dhesi UUCP: ...!{iuvax,pur-ee}!bsu-cs!dhesi Career change search is on -- ask me for my resume