std::experimental::filesystem::file_size

From cppreference.com
< cpp‎ | experimental‎ | fs
Defined in header <experimental/filesystem>
uintmax_t file_size( const path& p );
(1) (filesystem TS)
uintmax_t file_size( const path& p, error_code& ec );
(2) (filesystem TS)

Returns the size of a regular file. If p does not resolve to a regular file, returns -1.

The second version sets ec to an appropriate error code if an error occurs. Otherwise, ec is cleared with a call to ec.clear().

Contents

[edit] Parameters

p - path to the regular file
ec - error code to modify in case of error

[edit] Return value

The size of the file or -1 on error.

[edit] Exceptions

1) filesystem_error if an error occurs. The exception object is constructed with p as an argument. The error code is set to an appropriate error code for the error that caused the failure.
2)
noexcept specification:  
noexcept
  

[edit] See also