1#include <sys/stat.h>
2
3bool IsPathExist(const std::string &s)
4{
5 struct stat buffer;
6 return (stat (s.c_str(), &buffer) == 0);
7}
8
1#include <sys/stat.h>
2
3int main() {
4 struct stat buffer;
5 std::string string = "Hello";
6
7 if (stat(&string.c_str(), &buffer) != 0) {
8 std::cout << "'Hello' directory doesn't exist!";
9 } else {
10 std::cout << "'Hello' directory exists!";
11 }
12}