vl-filename-mktemp

AutoCad AutoLISP Functions

 
vl-filename-mktemp
 
 
 

Calculates a unique file name to be used for a temporary file

(vl-filename-mktemp [pattern directory extension])

Arguments

pattern

A string containing a file name pattern; if nil or absent, vl-filename-mktemp uses “$VL~~”.

directory

A string naming the directory for temporary files; if nil or absent, vl-filename-mktemp chooses a directory in the following order:

  • The directory specified in pattern, if any.
  • The directory specified in the TMP environment variable.
  • The directory specified in the TEMP environment variable.
  • The current directory.
extension

A string naming the extension to be assigned to the file; if nil or absent, vl-filename-mktemp uses the extension part of pattern (which may be an empty string).

Return Values

A string containing a file name, in the following format:

directory\base<XXX><.extension>

where:

base is up to 5 characters, taken from pattern

XXX is a 3-character unique combination

All file names generated by vl-filename-mktemp during a VLISP session are deleted when you exit VLISP.

Examples

_$ (vl-filename-mktemp)
"C:\\TMP\\$VL~~004"
_$ (vl-filename-mktemp "myapp.del")
"C:\\TMP\\MYAPP005.DEL"
_$ (vl-filename-mktemp "c:\\acadwin\\myapp.del")
"C:\\ACADWIN\\MYAPP006.DEL"
_$ (vl-filename-mktemp "c:\\acadwin\\myapp.del")
"C:\\ACADWIN\\MYAPP007.DEL"
_$ (vl-filename-mktemp "myapp"
"c:\\acadwin")
"C:\\ACADWIN\\MYAPP008"
_$ (vl-filename-mktemp "myapp"
"c:\\acadwin" ".del")
"C:\\ACADWIN\\MYAPP00A.DEL"