COHERENT manpages

This page displays the COHERENT manpage for dup() [Duplicate a file descriptor].

List of available manpages
Index


dup() -- System Call (libc)

Duplicate a file descriptor
#include <unistd.h>
int dup(fd) int fd;

dup()  duplicates the  existing  file descriptor  fd, and  returns the  new
descriptor.  The returned value is the smallest file descriptor that is not
already in use by the calling process.

See Also

dup2(),
fopen(),
fdopen(),
libc,
stdio.h,
unistd.h
POSIX Standard, §6.2.1

Diagnostics

dup() returns a  number less than zero when an  error occurs, such as a bad
file descriptor or no file descriptor available.