DOS Fn 45H: Duplicate a File Handle
Compatibility: 2.0+
Expects: AH 45H
BX existing file handle
──────────────────────────────────────────────────────────────────
Returns: AX new file handle that duplicates the original
error code if CF is set to CY
──────────────────────────────────────────────────────────────────
Info: Creates an additional file handle that refers to the same I/O
stream as an existing file handle.
Any motion of the file read/write pointer for one handle will
also affect that of the duplicate -- including any file read,
write, or file pointer motion via Fn 42H (Lseek).
The new handle inherits the Open Mode of the original.
Notes: ■ This function has one main use in a single-tasking system: You
can close the duplicate handle, forcing DOS to FLUSH THE FILE
BUFFERS. This dup/close sequence is faster than closing and
re-opening a disk file. DOS 3.3+ offers a better method with
Fn 68H (Commit).
See Also: Handle-Oriented File I/O
Fn 46H (redirect a handle to a different file/device)
Standard I/O
DOS Functions
-♦-