Date: Mon, 27 Oct 1997 11:19:36 +0200 (IST) From: Eli Zaretskii To: firewind cc: djgpp AT delorie DOT com Subject: Re: Checking to see if I file exists In-Reply-To: <62p2v2$1am@sjx-ixn10.ix.netcom.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On 24 Oct 1997, firewind wrote: > This could be misleading though... fopen() can fail for many more reasons > than simply, 'file does not exist'... To be sure that `fopen' failed because the file did not exist, the code should check if errno == ENOENT. But I agree that `fopen' is not the best way to test whether a file exists, primarily because it's a very expensive system call. `stat' or `access' are better. `__file_exists' is better still, but it's non-portable.