[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Function 45h (69)        Duplicate a File Handle (DUP)

    Creates a new file handle by duplicating the existing handle of an
    open file or device. The new handle shares the existing file pointer.

       On entry:      AH         45h
                      BX         File handle

       Returns:       AX         Duplicate file handle, or
                                 Error code, if CF is set

       Error Codes:   4          No handles available
                      6          Invalid handle

                      Call Function 59h for extended error code information
                      (DOS 3.0 and above).

  --------------------------------------------------------------------------

    Function 45h (DUP) returns a new file handle that refers to the same
    file or device as the old file handle specified in BX.

       Notes:         Moving the file pointer of either handle by a Read,
                      Write, or Lseek causes the other handle to be
                      changed also. However, closing one handle does not
                      close the other.

                      By duplicating a handle and closing one of the
                      handles, you can flush the file to disk and update
                      the directory; since the other handle will still be
                      open, you won't need to re-open the file, a time-
                      consuming process.

See Also: 46h 59h
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson