is directory found!

closed account (28poGNh0)
I want to check if a directory exists using its path like this


1
2
3
4
5
6
7
8
9
int main()
{
    string dirPath = "c:\\dir";

    bool b = function(dirPath);
    if(b==true)
        cout << "Directory exists" << endl;
    else cout << "Cannot find this dir" << endl;
}
closed account (28poGNh0)
any help
1
2
3
4
#include <unistd.h>
bool exist(const char *path){
   return access(path, F_OK)==0;
}
closed account (28poGNh0)
Thanks a lot @ne555
Topic archived. No new replies allowed.