| Technical Specification | ||||
| Filesystem library(filesystem TS) | ||||
| Library fundamentals(library fundamentals TS) | ||||
| Library fundamentals 2(library fundamentals TS v2) | ||||
| Library fundamentals 3(library fundamentals TS v3) | ||||
| Extensions for parallelism(parallelism TS) | ||||
| Extensions for parallelism 2(parallelism TS v2) | ||||
| Extensions for concurrency(concurrency TS) | ||||
| Extensions for concurrency 2(concurrency TS v2) | ||||
| Concepts(concepts TS) | ||||
| Ranges(ranges TS) | ||||
| Reflection(reflection TS) | ||||
| Mathematical special functions(special functions TR) | ||||
| Experimental Non-TS | ||||
| Pattern Matching | ||||
| Linear Algebra | ||||
| std::execution | ||||
| Contracts | ||||
| 2D Graphics |
| Classes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Functions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| File types | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Defined in header <experimental/filesystem> | ||
bool create_directory(const path& p); bool create_directory(const path& p, error_code& ec); | (1) | (filesystem TS) |
bool create_directory(const path& p,const path& existing_p); bool create_directory(const path& p,const path& existing_p, error_code& ec); | (2) | (filesystem TS) |
bool create_directories(const path& p); bool create_directories(const path& p, error_code& ec); | (3) | (filesystem TS) |
stat(existing_p.c_str(),&attributes_stat)mkdir(p.c_str(), attributes_stat.st_mode)
CreateDirectoryExW(existing_p.c_str(), p.c_str(),0)
The non-throwing overloads returnfalse if any error occurs.
Contents |
| p | - | the path to the new directory to create |
| existing_p | - | the path to a directory to copy the attributes from |
| ec | - | out-parameter for error reporting in the non-throwing overload |
The attribute-preserving overload(2) is implicitly invoked bycopy() when recursively copying directories. Its equivalent in boost.filesystem iscopy_directory (with argument order reversed).
#include <cstdlib>#include <experimental/filesystem>#include <fstream>#include <iostream>namespace fs= std::experimental::filesystem; int main(){ fs::create_directories("sandbox/1/2/a"); fs::create_directory("sandbox/1/2/b"); fs::permissions("sandbox/1/2/b", fs::perms::remove_perms| fs::perms::others_all); fs::create_directory("sandbox/1/2/c","sandbox/1/2/b");std::system("ls -l sandbox/1/2"); fs::remove_all("sandbox");}
Possible output:
drwxr-xr-x 2 user group 4096 Apr 15 09:33 adrwxr-x--- 2 user group 4096 Apr 15 09:33 bdrwxr-x--- 2 user group 4096 Apr 15 09:33 c
| creates a symbolic link (function)[edit] | |
| copies files or directories (function)[edit] | |
| identifies file system permissions (enum)[edit] |