NAME

FFI::C::PosixFile - Perl interface to C File pointer with POSIX extensions

VERSION

version 0.15

SYNOPSIS

use FFI::C::PosixFile;

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

DESCRIPTION

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.

SEE ALSO

FFI::C
FFI::C::Array
FFI::C::ArrayDef
FFI::C::Def
FFI::C::File
FFI::C::PosixFile
FFI::C::Struct
FFI::C::StructDef
FFI::C::Union
FFI::C::UnionDef
FFI::C::Util
FFI::Platypus::Record

AUTHOR

Graham Ollis <plicease@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2020-2022 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.