- IO operations can fail.
- And they will fail!
- Either...
- throws
std::filesystem::filesystem_error
or... - returns
std::error_code
as output_parameter
- throws
Most functions have 2 signatures, one throwing and one noexcept
bool exists( const std::filesystem::path& p );
bool exists( const std::filesystem::path& p,
std::error_code& ec ) noexcept;
exists(p)
file_size(p)
is_empty(p)
,is_regular_file()
, ...- links, permissions, mtime, status, ...
std::fstream(const char*, mode)
(since C++98)std::fstream(std::string const&, mode)
(since C++11)std::fstream(std::filesystem::path const&, mode)
(since C++17)
copy(from, to)
- copy file or directorycopy_file(from, to)
- copy file onlyrename(old_p, new_p)
remove(p)
,remove_all(p)