![[About]](r:\html\rexxabout.gif)
![[Toc]](r:\html\rexxtoc.gif)
0.9b (c) 1995 Peter Childs
Function: SysTempFileName
Syntax: file = SysTempFileName(template, [filter])
template The template that describes the temporary file or
directory name to be returned. The template should
resemble a valid file or directory specification with up
to 5 filter characters.
filter The filter character found in the template. Each filter
character found in the template is replaced with a numeric
value. The resulting string represents a file or
directory that does not exist. The default filter
character is ?.
file A file or directory that does not currently exist. If an
error occurred or if no unique file or directory exists
given the template provided, a null string is returned.
Purpose: Returns a unique file or directory name given a certain
template. Useful when a program requires a temporary file but
is not to overwrite an existing file.
Examples:
/* Code */
say SysTempFileName('C:\TEMP\MYEXEC.???')
say SysTempFileName('C:\TEMP\??MYEXEC.???')
say SysTempFileName('C:\MYEXEC@.@@@', '@')
/* Output */
C:\TEMP\MYEXEC.251
C:\TEMP\10MYEXEC.392
C:\MYEXEC6.019
Note:
Since it is not required that the filter characters
be contiguous within the template, it is impossible
to quickly determine the number of files already
residing in the target directory that would fit the
template description.
SysTempFileName uses a random number algorithm to
determine a number to replace the filter characters
with. It then tests if the resulting file exists.
If it does not, it increments the number, replaces
the filter characters, and tests for the existence of
the new file, and so on. This continues until a free
file is found or all possibilities have been
exhausted.
Inf-HTML End Run - Successful