std::experimental::filesystem::directory_entry::status,std::experimental::filesystem::directory_entry::symlink_status (3) - Linux Manuals
std::experimental::filesystem::directory_entry::status,std::experimental::filesystem::directory_entry::symlink_status: std::experimental::filesystem::directory_entry::status,std::experimental::filesystem::directory_entry::symlink_status
NAME
std::experimental::filesystem::directory_entry::status,std::experimental::filesystem::directory_entry::symlink_status - std::experimental::filesystem::directory_entry::status,std::experimental::filesystem::directory_entry::symlink_status
Synopsis
file_status status() const; (1) (filesystem TS)
file_status status( error_code& ec ) const;
file_status symlink_status() const; (2) (filesystem TS)
file_status symlink_status( error_code& ec ) const;
1) Returns the potentially cached status of the entry, as if determined by a status call (symlinks are followed to their targets)
2) Returns the potentially cached status of the entry, as if determined by a symlink_status call (symlinks are not followed)
Parameters
ec - out-parameter for error reporting in the non-throwing overload
Return value
The status of the file referred to by the entry.
Exceptions
The overload that does not take a error_code& parameter throws filesystem_error on underlying OS API errors, constructed with p as the first argument and the OS error code as the error code argument. std::bad_alloc may be thrown if memory allocation fails. The overload taking a error_code& parameter sets it to the OS API error code if an OS API call fails, and executes ec.clear() if no errors occur. This overload has
noexcept specification:
noexcept
Notes
The file status information is usually provided as a byproduct of directory iteration, in which case it is cached and may be obtained by these member functions without the cost of an additional system call. During directory iteration, calling status is unnecessary and accessors such as is_directory should be called with the cached status value, not with a path.
Example
// Run this code
Possible output:
See also
file_status (class)
status determines file attributes, checking the symlink target
symlink_status (function)
status_known (function)