Classes
Let's take a look at the different components of the filesystem library.
We'll cover the following
There are many classes encapsulating a specific aspect of the filesystem.
Class | Description |
---|---|
path |
Represents a path. |
filesystem_error |
Defines an exception object. |
directory_entry |
Represents a directory entry. |
directory_iterator |
Defines a directory iterator. |
recursive_directory_iterator |
Defines a recursive directory iterator. |
file_status |
Stores information about the file. |
space_info |
Represents filesystem information. |
file_type |
Indicates the type of a file. |
perms |
Represents file access permissions. |
perm_options |
Represents options for the function permissions |
copy_options |
Represents options for the functions copy |
directory_options |
Represents options for the functions directory_iterator |
file_time_type |
Represents file time. |
The various classes the filesystem
Manipulating the permissions of a file
The permissions for a file are represented by the class std::filesystem::perms
. It is a BitmaskType and can, therefore, be manipulated by bitwise operations. The access permissions are based on POSIX.
The program from en.cppreference.com shows how you can read and manipulate the owner, group, and other (world) bits of a file.
Get hands-on with 1400+ tech skills courses.