is directory found!
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;
}
|
any help
1 2 3 4
|
#include <unistd.h>
bool exist(const char *path){
return access(path, F_OK)==0;
}
|
Thanks a lot @ne555
Topic archived. No new replies allowed.