Skip to content

Commit ed67f6b

Browse files
use string with mkdir
1 parent a6489d4 commit ed67f6b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

mkdir.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ int main(){
88
struct stat st = {0};
99

1010
if (stat("newdir", &st) == -1) { //checking if the directory exists
11-
mkdir("newdir", 0700);
11+
mkdir("newdir", 0755);
12+
}
13+
14+
std::string mydir = "mydir";
15+
//need to convert from std::string to const char*
16+
if (stat(mydir.c_str(), &st) == -1) { //checking if the directory exists
17+
mkdir(mydir.c_str(), 0755);
1218
}
1319
}

0 commit comments

Comments
 (0)