On 2/2/19 3:16 AM, Shlomi Fish wrote:
On Sat, 2 Feb 2019 01:08:39 -0800
ToddAndMargo via perl6-users <perl6-users@perl.org> wrote:

Hi All,

Is there a way to modify this to start reading at
a specific index?  And include how many bytes (3000000)
to read as well?

       my $FileHandle     = open( $FileName, :bin, :ro );
       my Buf $BinaryFile = $FileHandle.read( 3000000 );

Many thanks,

See https://docs.perl6.org/routine/seek .

Thank you!

I am not sure exactly what they mean by "$whence".

method seek(IO::Handle:D: Int:D $offset, SeekType:D $whence --> True)

    SeekFromBeginning: The beginning of the file.

my Bool $GoodRead = seek($FileHandle, $offset, SeekFromBeginning );
my Bool $GoodRead = seek.$FileHandle( $offset, SeekFromBeginning );

Or do I need to assign something to a variable called "$whence"?

Many thanks,

Computers are like air conditioners.
They malfunction when you open windows

Reply via email to