open-temp-file &key file-type element-type directory prefix delete-when-close external-format => stream
A string or nil
.
A type specifier.
A pathname designator.
A string or nil
.
A generalized boolean.
An external file format designator.
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 the pathname for it. 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.
pathname
can be called to find the pathname that was used in 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 - 20 Sep 2017