# PXFDUP, PXFDUP2

POSIX Subroutine: Duplicates an existing file descriptor.

## Module

USE IFPOSIX

CALL PXFDUP (ifildes,ifid,ierror)

CALL PXFDUP2 (ifildes,ifildes2,ierror)

ifildes | (Input) INTEGER(4). The file descriptor to duplicate.
ifid | (Output) INTEGER(4). The returned new duplicated file descriptor.
ifildes2 | (Input) INTEGER(4). The number for the new file descriptor.
ierror | (Output) INTEGER(4). The error status.

If successful, ierror is set to zero; otherwise, an error code.

The PXFDUP subroutine creates a second file descriptor for an opened file.

The PXFDUP2 subroutine copies the file descriptor associated with ifildes. Integer number ifildes2 becomes associated with this new file descriptor, but the value of ifildes2 is not changed.

Parent topic: POSIX* Library Routines