In article <11**********************@z14g2000cwz.googlegroups .com>,
<he*******@yahoo.com> wrote:
I wasn't sure if this should go in a linux group or the C group, but
here I am.
How do I check for directory existence in C? It's gcc under Linux to
be exact, and I don't have the option of just making it to ensure that
it's there.
There are posix-specific functions that will let you do
that directly. opendir/readdir and stat come to mind.
But pure C itself doesn't really have any directory-related
functions.
A partial hack is to try to open a file in the directory.
If you can open a file in the directory, then the
directory must exist. However the converse is not
always true: if you cannot open the file, it may be
for other reasons like access permission, disk full,
running out of file descriptors, all kinds of stuff.