C++フォルダが存在するか否かを判断
482 ワード
フォルダが存在するかどうかを判断
#include
#include
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;
}