qc.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
dup, dup2
 Summary Example                         Up Contents Index Back
────────────────────────────────────────────────────────────────────────────
 
     The dup and dup2 functions cause a second file handle to be
     associated with a currently open file. Operations on the file can
     be carried out using either file handle. The type of access
     allowed for the file is unaffected by the creation of a new
     handle.
 
     The dup function returns the next available file handle for the
     given file. The dup2 function forces <handle2> to refer to the
     same file as <handle1>. If <handle2> is associated with an open
     file at the time of the call, that file is closed.
 
     Return Value
 
     The dup function returns a new file handle. The dup2 function
     returns 0 to indicate success. Both functions return -1 if an
     error occurs and set errno to either EBADF or EMFILE.
                                    -♦-