Creates a "temp file" and returns a pathname or a stream to it.
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
A string or
A type specifier.
A pathname designator.
A string or
A generalized boolean.
An external file format designator.
An I/O stream.
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
". 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.
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.
The default "temp directory" can be found by using get-temp-directory.
When delete-when-close is non-nil, it tries to delete the file when the stream is closed, but that does not necessarily succeed. On Microsoft Windows it certainly fails when the file is still opened (for example, by another stream in the same process or another process)
LispWorks User Guide and Reference Manual - 20 Sep 2017