std::experimental::filesystem:: temp_directory_path
From cppreference.net
<
cpp
|
experimental
|
fs
|
헤더 파일에 정의됨
<experimental/filesystem>
|
||
|
path temp_directory_path
(
)
;
path temp_directory_path ( error_code & ec ) ; |
(1) | (filesystem TS) |
임시 파일에 적합한 디렉토리 위치를 반환합니다.
목차 |
매개변수
(없음)
반환값
임시 파일에 적합한 디렉토리입니다. 경로는 존재하고 디렉토리임이 보장됩니다.
error_code&
인수를 받는 오버로드는 오류 시 빈 경로를 반환합니다.
예외
The overload that does not take an error_code & parameter throws filesystem_error on underlying OS API errors, constructed with 반환될 경로 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
noexcept
명세:
noexcept
참고 사항
POSIX 시스템에서 경로는 환경 변수
TMPDIR
,
TMP
,
TEMP
,
TEMPDIR
에 지정된 경로일 수 있으며, 이 중 어느 것도 지정되지 않은 경우
"/tmp"
경로가 반환됩니다.
Windows 시스템에서 경로는 일반적으로
GetTempPath
가 반환하는 경로입니다.
예제
이 코드 실행
#include <experimental/filesystem> #include <iostream> namespace fs = std::experimental::filesystem; int main() { std::cout << "Temp directory is " << fs::temp_directory_path() << '\n'; }
가능한 출력:
Temp directory is "C:\Windows\TEMP\"
참고 항목
|
임시 파일을 생성하고 열며 자동 삭제됨
(함수) |