Method lrs::file::File::duplicate

Creates a new file referring to the same file description.

Syntax

impl File {
    fn duplicate(&self) -> Result<File, Errno>
}

Return value

Returns the new file.

Remarks

The close on exec flag will be set on the new file.

The new file has its own file descriptor which refers to the same file description. This means that changing the close on exec flag on this file will not affect the other file and neither does closing this file. But writing, reading, seeking, etc. will affect the other file.

See also