判断一个文件夹是否存在
#include <iostream>
#include <dirent.h>
using namespace std;
int main()
{
std::string path = "./post";
DIR * dir; // return value for opendir()
dir = opendir(path.data());
if( dir == nullptr )
{
cout<< "dir don't exist. "<< endl;
}
else {
cout << "open dir success." << endl;
}
return 0;
}