DOS Fn 5aH: Create Unique Temporary File
Compatibility: 3.0+
Expects: AH 5aH
DS:DX address of ASCIIZ▲ path (i.e., d:\path\0)
CX file attribute
──────────────────────────────────────────────────────────────────
Returns: AX error code if CF is set to CY
file handle (if no error)
DS:DX (+n) filename has been appended to path
──────────────────────────────────────────────────────────────────
Info: Creates (opens) a file with a unique filename in a specified
directory and returns a handle to that file and its full name.
The DOS command processor uses this function to create the
temporary "piping" files used in I/O redirection.
The pathspec must be ready to receive a filename at its end; that
is, the last character must be a backslash (\) and you must
provide at least 12 bytes at the end of the string. In summary,
it must be in the form:
"d:\path\",0 (specify drive and path) ...OR...
"d:",0 (default directory of a drive) ...OR...
"d:\",0 (root directory of a drive) ...OR...
"",0 (default drive and directory)
Upon return, the string at DS:DX has a unique filename appended
to it and the file is open for read/write Access Mode.
Notes: ■ DOS builds a filename of hex digits obtained from the current
system date/time. If the filename already exists, DOS keeps
trying new names until a file can be created.
■ The files created ARE NOT really TEMPORARY, and must be deleted
via Fn 41H if you don't want them to clutter up your
directories.
■ It is good practice to check the environment for a variable
named TEMP and use its value as the directory for the file.
See Also: Handle-Oriented File I/O
DOS Functions
-♦-