Path: utzoo!utgpu!watserv1!watmath!att!bu.edu!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!dkuug!freja.diku.dk!rimfaxe.diku.dk!kimcm From: kimcm@rimfaxe.diku.dk (Kim Christian Madsen) Newsgroups: comp.lang.c Subject: Re: FILE *fp[]; /* is this possible? */ Message-ID: <1990Nov29.153505.27783@diku.dk> Date: 29 Nov 90 15:35:05 GMT References: <1990Nov27.131327.21662@agate.berkeley.edu> <1990Nov28.152146.19560@ssd.kodak.com> Sender: news@diku.dk (The Netnews System) Organization: Department Of Computer Science, University Of Copenhagen Lines: 18 weimer@ssd.kodak.com (Gary Weimer) writes: >for(i=0;i!=256;i++) > if ((fp[i]=fopen(file_name[i],"r+")) <= 0) /* some will probably */ > /* complain about using */ > /* <= 0 */ YES, for more than one reason: 1) fopen returns a FILE * and should be tested against the constant NULL, or (FILE *) NULL if you want explicit casting. 2) If the pointer returned by fopen points to a memory location in the high end it is very possible that when converted to an int for the comparison it will be negative. Kim Chr. Madsen