Mail Archives: djgpp-workers/1999/05/12/10:32:13
Bonjour
> > if (stat(file_name, &stbuf) != 0)
> > return 0;
>
> `stat' is too expensive for this. Use `__file_exist' or `access'
> instead. (I think `access' is a better alternative for
> Unix-compatibility functions, since it doesn't fail for root
> directories and devices.)
I'm not sure about __file_exist, since, according to reference
on www.delorie.com/djgpp/doc/libc it does not seem to set the errno
appropriately.
realpath() is use to kill two birds with one stone.
Canonize the path and checking for accessibility of the file.
I agree, access() will do nicely to.
#include <unistd.h>
...
if (access(file_name, R_OK) != 0)
return NULL;
...
--
au revoir, alain
----
Aussi haut que l'on soit assis, on est toujours assis que sur son cul !!!
- Raw text -