Mail Archives: djgpp/1997/08/23/09:50:44
Peter J. Farley III (pjfarley AT dorsai DOT org) wrote:
: Perusing the DJGPP libc sources, it seems to me that access(filename,
: R_OK) will give you the results that you want, without the overhead of
: an fopen and an fclose. Just call:
: access("filename.ext", R_OK)
: Zero return value means the file is available for reading, which
: implies that it actually exists. So this code should work:
: if (access("filename.ext", R_OK)) {
: fprint("FILE %s does not exist\n", "filename.ext");
: exit(1);
: }
: /* From here on we know the file exists... */
Like was already pointed out, this doesn't work over networks sometimes,
etc... Also, if the read permission were turned off it would deny you.
I would take a look at findfirst();
--
+--- -- -- - -
| [pHiXx/VorteX]
: phixx AT usa DOT net
:
.
- Raw text -