29 Input/output library [input.output]

29.12 File systems [filesystems]

29.12.13 Filesystem operation functions [fs.op.funcs] Space [fs.op.space]

space_info filesystem::space(const path& p); space_info filesystem::space(const path& p, error_code& ec) noexcept;
Returns: An object of type space_­info.
The value of the space_­info object is determined as if by using POSIX statvfs to obtain a POSIX struct statvfs, and then multiplying its f_­blocks, f_­bfree, and f_­bavail members by its f_­frsize member, and assigning the results to the capacity, free, and available members respectively.
Any members for which the value cannot be determined shall be set to static_­cast<uintmax_­t>(-1).
For the signature with argument ec, all members are set to static_­cast<uintmax_­t>(-1) if an error occurs.
Throws: As specified in [fs.err.report].
Remarks: The value of member space_­info​::​available is operating system dependent.
[Note 1:
available might be less than free.
— end note]