www.delorie.com/djgpp/doc/libc/libc_281.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

dup

Syntax

 
#include <unistd.h>

int dup(int old_handle);

Description

This function duplicates the given file handle. Both handles refer to the same file and file pointer.

Return Value

The new file handle, or -1 if error.

Portability

ANSI/ISO C No
POSIX 1003.2-1992; 1003.1-2001

Example

 
do_file(dup(fileno(stdin)));


  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2004   by DJ Delorie     Updated Apr 2004