Mail Archives: djgpp/1997/10/27/04:26:08
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.
- Raw text -