[Toc][Index]

DosDupHandle


Bindings:  C, MASM 

This call returns a new file handle for an open file, which refers to the 
same position in the file as the old file handle. 
 DosDupHandle     (OldFileHandle, NewFileHandle) 
 
 OldFileHandle (HFILE) - input 
    Current file handle. 
 NewFileHandle (PHFILE) - input/output 
    Address of a Word.  On input, values and their meanings are: 
    Value     Definition 
     FFFFH    Allocate a new file handle and return it here. 
    <>FFFFH   Assign this value as the new file handle. A valid value is 
              any of the handles assigned to standard I/O, or the handle 
              of a file currently opened by the process. 
              On output, a value of FFFFH returns a value for 
              NewFileHandle, allocated by OS/2. 
 rc (USHORT) - return 
    Return code descriptions are: 
    0         NO_ERROR 
    4         ERROR_TOO_MANY_OPEN_FILES 
    6         ERROR_INVALID_HANDLE 
    114       ERROR_INVALID_TARGET_HANDLE 
 
 Remarks 
 Duplicating the handle duplicates and ties all handle-specific 
 information between OldFileHandle and NewFileHandle. For example, if you 
 move the read/write pointer of either handle by a DosRead, DosWrite, or 
 DosChgFilePtr function call, the pointer for the other handle is also 
 changed. 
 The valid values for NewFileHandle include the following handles for 
 standard I/O, which are always available to the process: 
 0000H     Standard input 
 0001H     Standard output 
 0002H     Standard error. 
 
 If a file handle value of a currently open file is specified in 
 NewFileHandle, the file handle is closed before it is redefined as the 
 duplicate of OldFileHandle. Avoid using arbitrary values for 
 NewFileHandle. 
 Issuing a DosClose against a file handle does not affect the duplicate 
 handle. 

Created using Inf-PHP v.2 (c) 2003 Yuri Prokushev
Created using Inf-HTML v.0.9b (c) 1995 Peter Childs