std-filename-mktemp | ![]() |
std-filename-mktemp returns the name of a not existing temporary filename. The template argument may be a fully qualified or partial pathname or just nil. The pathname portions of the temporary filename will be taken from the template.
The directory is by default the value of the TEMP or TMP environment variable.
The filename prefix is by default "$STD~", the extension is by default ".AC$". The filename prefix is cut to max. 5 characters on dos based systems to have at least three free characters for the unique filenames.
The temporary files should be deleted when the application stops, therefore the global variable *STD-MKTEMP* holds all filename created with std-filename-mktemp.
After a certain number of created temporary files the system automatically deletes them by calling the internal function (STD-%DELETE-MKTEMP). This number is file system dependant, stored in *STD:MKTEMP-TRESHOLD* and is by default 500.
Note
std-filename-mktemp is similar to the VL extension vl[x]-filename-mktemp but stores the filenames to be able to delete them automatically when the creation of temporary files will slow down the operating system, on any error and on std-var-restore
It also takes only one argument and gets the pathname, basename and extension from this argument only.
(std-filename-mktemp nil) => "c:\\tmp\\$STD~000.AC$ (std-filename-mktemp "/mydir/$t") => "/mydir/$T000.AC$
prefix: NIL or a string, a partial or fully qualified filename specifier.
A string. A fully qualified filename specifier.
It may call (getenv "TEMP"). It adds the returned filename to the global variable
*STD-MKTEMP* and also modifies *STD:MKTEMP-LENGTH*.
It may call (std-file-delete) which on some systems is slow and creates unwanted side effects: shell windows are created and removed, AutoCAD switches back and forth between the text and graphics screen, and so on.
(std-require 'STDFILE)
Defined in STDFILE