The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

Name

SPVM::IO::File - File Input/Output

Usage

use IO::File;
 
my $io_file = IO::File->new("file", "r");
$io_file->print("Hello");

Description

SPVM::IO::File provides File Input/Output.

Parent Class

IO::Handle.

Fields

stream

has stream : Sys::IO::FileStream;

input_line_number

has input_line_number : long;

Class Methods

new

static method new : IO::File ($file_name : string = undef, $open_mode : string = undef);

new_from_fd

static method new_from_fd : IO::Handle ($fd : int, $open_mode : string = undef);

Instance Methods

input_line_number

method input_line_number : long ();

Gets ""input_line_number" field.

set_input_line_number

method set_input_line_number : void ($input_line_number : long);

Sets ""input_line_number" field.

open

method open : void ($file_name : string, $open_mode : string);

fdopen

method fdopen : void ($fd : int, $open_mode : string);

init

protected method init : void ();

DESTROY

method DESTROY : void ();

getline

method getline : string ();

getlines

method getlines : string ();

close

method close : int ();

eof

method eof : int ();

fileno

method fileno : int ();

Gets the file descriptor of "stream" field.

getc

method getc : int ();

print

method print : int ($string : string);

clearerr

method clearerr : void ();

error

method error : int ();

flush

method flush : void ();

ungetc

method ungetc : int ($c : int);

write

method write : int ($string : string, $length : int = -1, $offset : int = 0);

read

method read : int ($string : mutable string, $length : int = -1, $offset : int = 0);

printflush

method printflush : void ($string : string);

getline

method getline : string ();

getlines

method getlines : string ();

ungetc

method ungetc : int ($c : int);

clearerr

method clearerr : void ();

error

method error : int ();

getc

method getc : int ();

eof

method eof : int ();

sync

method sync : void ();

Syncs the stream associated with the file descriptoer "FD".

This method calls Sys#fsync with the file descriptor "FD".

truncate

method truncate : void ($legnth : long);

Trancates the stream associated with the file descriptoer FD.

This method calls Sys#ftruncate with the file descriptor "FD".

See Also

Perl's IO::File

IO::File is a Perl's IO::File porting to SPVM.

Copyright & License

Copyright (c) 2023 Yuki Kimoto

MIT License