Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!brutus.cs.uiuc.edu!uakari.primate.wisc.edu!uflorida!usfvax2!tct!chip From: chip@tct.uucp (Chip Salzenberg) Newsgroups: comp.lang.c Subject: Re: fopen() and memory shortage Message-ID: <25D2CE9D.1135@tct.uucp> Date: 9 Feb 90 14:07:24 GMT References: <2935@tukki.jyu.fi> <256@heel.ribs.UUCP> Organization: ComDev/TCT, Sarasota, FL Lines: 17 According to reznick@ribs.UUCP (Larry Reznick): >Try using the stat() function, which gives directory information for a >pathname without opening the file. Your fexist() function would use >stat() to determine if the file exists. However, Larry then goes on to mention: >The open()/close() functions are not standard; fopen()/fclose() are. >Using open()/close() may impact portability. Using stat() will impact portability even more. If you need to conserve memory, just be sure to call "setbuf(fp, (char *)NULL)" after the fopen() call(s) in question. An endearing characteristic of unbuffered streams is that they don't need to allocate buffers. :-) -- Chip Salzenberg at ComDev/TCT , "The Usenet, in a very real sense, does not exist."