30
Input/output library
[input.output]
30.10
File systems
[filesystems]
30.10.15
Filesystem operation functions
[fs.op.funcs]
30.10.15.14
File size
[fs.op.file_size]
uintmax_t file_size(const path& p); uintmax_t file_size(const path& p, error_code& ec) noexcept;
1
#
Returns:
(1.1)
If
!exists(p)
an error is reported (
[fs.err.report]
)
.
(1.2)
Otherwise, if
is_regular_file(p)
, the size in bytes of the file
p
resolves to, determined as if by the value of the POSIX
stat
structure member
st_size
obtained as if by POSIX
stat()
.
(1.3)
Otherwise, the result is
implementation-defined
.
The signature with argument
ec
returns
static_cast<uintmax_t>(-1)
if an error occurs
.
2
#
Throws:
As specified in
[fs.err.report]
.