< cpp | filesystem
C++Nov 02, 2019 Graphical Unix-like operating system for x86 computers. SerenityOS is a love letter to '90s user interfaces with a custom Unix-like core. It flatters with sincerity by stealing beautiful ideas from various other systems.
- /dev/null is the gateway to oblivion. Information sent to it takes up no disk space or memory. So it can be used as a destination for vast amounts of data with no use of resources.
- In a procedural language like ANSI C, or C (including Dev-C etc), automatic variables are assigned memory off the stack, but this is a very limited resource, sometimes as little as 10Kb for some environments, but this can vary - good rule of thumb: don't COUNT ON USING STACK MEMORY.
Language | ||||
Standard Library Headers | ||||
Freestanding and hosted implementations | ||||
Named requirements | ||||
Language support library | ||||
Concepts library(C++20) | ||||
Diagnostics library | ||||
Utilities library | ||||
Strings library | ||||
Containers library | ||||
Iterators library | ||||
Ranges library(C++20) | ||||
Algorithms library | ||||
Numerics library | ||||
Input/output library | ||||
Localizations library | ||||
Regular expressions library(C++11) | ||||
Atomic operations library(C++11) | ||||
Thread support library(C++11) | ||||
Filesystem library(C++17) | ||||
Technical Specifications |
Classes | ||||
Functions | ||||
File types |
Defined in header <filesystem> | ||
bool is_regular_file(std::filesystem::file_status s )noexcept; | (1) | (since C++17) |
bool is_regular_file(conststd::filesystem::path& p ); bool is_regular_file(conststd::filesystem::path& p, std::error_code& ec )noexcept; | (2) | (since C++17) |
Checks if the given file status or path corresponds to a regular file.
2) Equivalent to is_regular_file(status(p)) or is_regular_file(status(p, ec)) respectively.
[edit]Parameters
s | - | file status to check |
p | - | path to examine |
ec | - | error code to store the error status to |
[edit]Return value
true if the file indicated by p
or if the type indicated by s
refers to a regular file, false otherwise. The non-throwing overload returns false if an error occurs.
[edit]Exceptions
2) The overload that does not take a std::error_code& parameter throws filesystem_error on underlying OS API errors, constructed with
p
as the first path argument and the OS error code as the error code argument. The overload taking a std::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. Any overload not marked noexcept
may throw std::bad_alloc if memory allocation fails.[edit]Notes
The throwing overload is additionally specified to throw std::filesystem::filesystem_error if status(p)
would throw.
[edit]Example
Possible output:
[edit]See also
(C++17)(C++17) | determines file attributes determines file attributes, checking the symlink target (function)[edit] |
(C++17) | represents file type and permissions (class)[edit] |
(C++17) | checks whether file status is known (function)[edit] |
(C++17) | checks whether the given path refers to block device (function)[edit] |
(C++17) | checks whether the given path refers to a character device (function)[edit] |
(C++17) | checks whether the given path refers to a directory (function)[edit] |
(C++17) | checks whether the given path refers to a named pipe (function)[edit] |
(C++17) | checks whether the argument refers to an other file (function)[edit] |
(C++17) | checks whether the argument refers to a named IPC socket (function)[edit] |
(C++17) | checks whether the argument refers to a symbolic link (function)[edit] |
(C++17) | checks whether path refers to existing file system object (function)[edit] |
checks whether the directory entry refers to a regular file (public member function of std::filesystem::directory_entry )[edit] |
C Dev Null Os Free
C Dev Null Os Download
Retrieved from 'https://en.cppreference.com/mwiki/index.php?title=cpp/filesystem/is_regular_file&oldid=105045'