Make directory path: Difference between revisions
Content added Content deleted
No edit summary |
|||
Line 137: | Line 137: | ||
return 0; |
return 0; |
||
}</lang> |
}</lang> |
||
=={{header|C++|CPP}}== |
|||
<lang cpp> |
|||
#include <filesystem> |
|||
#include <iostream> |
|||
namespace fs = std::experimental::filesystem; |
|||
int main(int argc, char* argv[]) |
|||
{ |
|||
if(argc != 2) |
|||
{ |
|||
std::cout << "usage: mkdir <path>\n"; |
|||
return -1; |
|||
} |
|||
fs::path pathToCreate(argv[1]); |
|||
if (fs::exists(pathToCreate)) |
|||
return 0; |
|||
if (fs::create_directories(pathToCreate)) |
|||
return 0; |
|||
else |
|||
{ |
|||
std::cout << "couldn't create directory: " << pathToCreate.string() << std::endl; |
|||
return -1; |
|||
} |
|||
} |
|||
</lang> |
|||
=={{header|C sharp|C#}}== |
=={{header|C sharp|C#}}== |
||
<lang csharp>System.IO.Directory.CreateDirectory(path)</lang> |
<lang csharp>System.IO.Directory.CreateDirectory(path)</lang> |