Function 46h (70) Force Handle Duplication (FORCDUP)
Force one handle to refer to the same file as another handle. (Both
handles must already exist.)
On entry: AH 46h
BX First file handle
CX Handle to be changed
Returns: AX 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).
--------------------------------------------------------------------------
This function causes the second handle (in CX) to refer to the same
file, at the same location, as the first handle (in BX). If the second
handle refers to an open file, that file is closed before the handle
is set equal to the first handle.
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.
This function is useful for redirection. For
example, to redirect standard output (predefined as
Handle 1) to a file, place 1 in CX, and in BX place
the handle for the file to which output is to be
redirected.
Seealso:
This page last updated on Fri Nov 30 10:49:50 MSK 2001
Copyright © 1992-2001, Vitaly Filatov, Moscow, Russia
Webmaster