Creates a "temp file" and returns a pathname or a stream to it.
hcl
create-temp-file &key file-type directory prefix => pathname
open-temp-file &key file-type element-type directory prefix delete-when-close external-format => stream
file-type⇩ |
A string or nil . |
directory⇩ |
A pathname designator. |
prefix⇩ |
A string or nil . |
element-type⇩ |
A type specifier. |
delete-when-close⇩ |
A generalized boolean. |
external-format⇩ |
An external file format designator. |
pathname⇩ |
A pathname. |
stream⇩ |
An I/O stream. |
The function open-temp-file
opens a "temp file". This is a new file in the "temp directory" which is guaranteed to be new. Its name contains a random element. The permissions of the file are read-write for the user only.
file-type is the file type of the name. The default value of file-type is "tmp".
directory, if supplied, is the directory to create the file in. It defaults to the default temp directory, which is what get-temp-directory returns, which defaults to what the Operating System uses as the temp directory.
prefix is used as the first part of the file name. The default prefix is "lwtemp_machinename_pid"
. More characters are appended to make the name unique and random.
If delete-when-close is non-nil, when the stream stream that is returned is closed, the system tries to delete the file quietly. That is, it tries to avoid giving an error if it fails.
element-type and external-format are interpreted the same way as in open.
The stream that is returned is an I/O stream.
The function create-temp-file
creates a new temp file and returns its pathname as pathname. create-temp-file
behaves exactly like open-temp-file
, as described above, except that it returns a pathname rather than a stream to the new file.
open-temp-file
. The file can be guaranteed to be new only if the temp directory is configured correctly.LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:30:35