std::experimental::filesystem:: temp_directory_path
|
Definiert in Header
<experimental/filesystem>
|
||
|
path temp_directory_path
(
)
;
path temp_directory_path ( error_code & ec ) ; |
(1) | (filesystem TS) |
Gibt den Verzeichnisstandort zurück, der für temporäre Dateien geeignet ist.
Inhaltsverzeichnis |
Parameter
(keine)
Rückgabewert
Ein Verzeichnis, das für temporäre Dateien geeignet ist. Der Pfad ist garantiert vorhanden und ein Verzeichnis. Die Überladung, die ein
error_code&
Argument nimmt, gibt bei einem Fehler einen leeren Pfad zurück.
Ausnahmen
The overload that does not take an error_code & parameter throws filesystem_error on underlying OS API errors, constructed with zurückzugebender Pfad 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 hasHinweise
Auf POSIX-Systemen kann der Pfad der in den Umgebungsvariablen
TMPDIR
,
TMP
,
TEMP
,
TEMPDIR
angegebene sein, und falls keine davon spezifiziert sind, wird der Pfad
"/tmp"
zurückgegeben.
Auf Windows-Systemen ist der Pfad typischerweise derjenige, der von
GetTempPath
zurückgegeben wird.
Beispiel
#include <experimental/filesystem> #include <iostream> namespace fs = std::experimental::filesystem; int main() { std::cout << "Temp directory is " << fs::temp_directory_path() << '\n'; }
Mögliche Ausgabe:
Temp directory is "C:\Windows\TEMP\"
Siehe auch
|
erstellt und öffnet eine temporäre, automatisch entfernende Datei
(Funktion) |