27 Input/output library [input.output]

27.10 File systems [filesystems]

27.10.15 Filesystem operation functions [fs.op.funcs]

27.10.15.39 Temporary directory path [fs.op.temp_dir_path]

path temp_directory_path(); path temp_directory_path(error_code& ec);

Returns: An unspecifed directory path suitable for temporary files. An error shall be reported if !exists(p) || !is_directory(p), where p is the path to be returned. The signature with argument ec returns path() if an error occurs.

Throws: As specified in [fs.err.report].

Example: For POSIX-based operating systems, an implementation might return the path supplied by the first environment variable found in the list TMPDIR, TMP, TEMP, TEMPDIR, or if none of these are found, "/tmp".

For Windows-based operating systems, an implementation might return the path reported by the Windows GetTempPath API function.  — end example ]