Horje
check if directory exists cpp Code Example
check if directory exists cpp
#include <sys/stat.h>

bool IsPathExist(const std::string &s)
{
  struct stat buffer;
  return (stat (s.c_str(), &buffer) == 0);
}
how to find out if a directory exists in cpp
#include <sys/stat.h>

int main() {
	struct stat buffer;
    std::string string = "Hello";
    
    if (stat(&string.c_str(), &buffer) != 0) {
    	std::cout << "'Hello' directory doesn't exist!";
    } else {
    	std::cout << "'Hello' directory exists!";
    }
}




Cpp

Related
print std map Code Example print std map Code Example
include all libraries in c++ Code Example include all libraries in c++ Code Example
clear screen in c++ Code Example clear screen in c++ Code Example
go read file to string Code Example go read file to string Code Example
how to sort a vector in reverse c++ Code Example how to sort a vector in reverse c++ Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
9