std::experimental::filesystem:: space
|
헤더 파일에 정의됨
<experimental/filesystem>
|
||
|
space_info space
(
const
path
&
p
)
;
space_info space ( const path & p, error_code & ec ) noexcept ; |
(filesystem TS) | |
경로명
p
가 위치한 파일시스템에 대한 정보를 결정합니다. POSIX
statvfs
에 의한 것처럼 동작합니다.
POSIX
struct statvfs
의 멤버들로부터 다음과 같이 설정된
space_info
타입의 객체를 채워서 반환합니다:
- space_info. capacity 는 f_blocks * f_frsize 로 설정된 것처럼 설정됩니다.
- space_info. free 는 f_bfree * f_frsize 로 설정됩니다.
- space_info. available 는 f_bavail * f_frsize 로 설정됩니다.
- 확인할 수 없는 멤버는 static_cast < std:: uintmax_t > ( - 1 ) 로 설정됩니다.
비예외(non-throwing) 오버로드는 오류 발생 시 모든 멤버를 static_cast < std:: uintmax_t > ( - 1 ) 로 설정합니다.
목차 |
매개변수
| p | - | 검사할 경로 |
| ec | - | 비예외 발생 오버로드에서 오류 보고를 위한 출력 매개변수 |
반환값
파일시스템 정보 (
space_info
객체).
예외
The overload that does not take an error_code & parameter throws filesystem_error on underlying OS API errors, constructed with p as the first argument and the OS error code as the error code argument. std:: bad_alloc may be thrown if memory allocation fails. The overload taking an 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. This overload has참고 사항
space_info. available 는 space_info. free 보다 작을 수 있습니다.
예제
#include <experimental/filesystem> #include <iostream> namespace fs = std::experimental::filesystem; int main() { fs::space_info devi = fs::space("/dev/null"); fs::space_info tmpi = fs::space("/tmp"); std::cout << " Capacity Free Available\n" << "/dev: " << devi.capacity << " " << devi.free << " " << devi.available << '\n' << "/tmp: " << tmpi.capacity << ' ' << tmpi.free << ' ' << tmpi.available << '\n'; }
가능한 출력:
Capacity Free Available
/dev: 4175114240 4175110144 4175110144
/tmp: 420651237376 411962273792 390570749952
참고 항목
|
파일 시스템의 사용 가능 공간 및 여유 공간에 대한 정보
(클래스) |