FFI::C::PosixFile - Perl interface to C File pointer with POSIX extensions
version 0.10
use FFI::C::PosixFile; my $stdout = FFI::C::PosixFile->fdopen(1, "w"); say $stdout->fileno; # prints 1
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.
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.
$mode
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.
my $file = FFI::C::PosixFile->fdopen($fd, $mode);
Create a new File instance from a POSIX file descriptor.
my $fd = $file->fileno;
Returns the POSIX file descriptor for the file pointer.
Graham Ollis <plicease@cpan.org>
This software is copyright (c) 2020 by Graham Ollis.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install FFI::C, copy and paste the appropriate command in to your terminal.
cpanm
cpanm FFI::C
CPAN shell
perl -MCPAN -e shell install FFI::C
For more information on module installation, please visit the detailed CPAN module installation guide.