FFI::C::PosixFile(3pm)

FFI::C::PosixFile3pm

Perl interface to c file pointer with posix extensions

Usage

 use FFI::C::PosixFile;
 
 my $stdout = FFI::C::PosixFile->fdopen(1, "w");
 say $stdout->fileno;  # prints 1

Version

version 0.15

Overview

This is a subclass of FFI::C::File which adds a couple of useful POSIX extensions that may not be available on non-POSIX systems. Trying to create an instance of this class will fail on platforms that do not support the extensions.

Constructor

fopen

 my $file = FFI::C::PosixFile->fopen($filename, $mode);

Opens the file with the given mode. See your standard library C documentation for the exact format of $mode.

new

 my $file = FFI::C::PosixFile->new($ptr);

Create a new File instance object from the opaque pointer. Note that it isn't possible to do any error checking on the type, so make sure that the pointer you are providing really is a C file pointer.

fdopen

 my $file = FFI::C::PosixFile->fdopen($fd, $mode);

Create a new File instance from a POSIX file descriptor.

Methods

fileno

 my $fd = $file->fileno;

Returns the POSIX file descriptor for the file pointer.

Releases

Unchanged in 2 releases since Debian 12 (Bookworm).

  1. 12–13

Author

Graham Ollis <[email protected]>

From libffi-c-perl 0.15-2 in Debian 13 (Trixie). Parsed by carta from the page's man source.