Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

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!";
    }
}
Source by www.systutorials.com #
 
PREVIOUS NEXT
Tagged: #find #directory #exists #cpp
ADD COMMENT
Topic
Name
1+9 =