| Extracted from Pike v7.8 release 866 at 2016-04-05.

[Top]
Stdio
Stdio.File

# Method Stdio.File()->dup2()

Method dup2

  `int dup2(Stdio.File to)`

Description

  Duplicate a file over another.

  This function works similarly to assign() , but instead of making the argument a reference to the same file, it creates a new file with the same properties and places it in the argument.

Returns

  Returns `1` on success and `0` (zero) on failure.

Note

  In Pike 7.7 and later to need not be open, in which case a new fd is allocated.

Note

  Note also that to is also assigned to the same backend (if any) as this object.

See also

  assign() , dup()