tell
ErrorsCollection

tell

Synthesised documentation from type/IO/Handle type/IO/CatHandle

From type/IO/Handle

See Original text in context

method tell(IO::Handle:D: --> Int:D)

Return the current position of the file pointer in bytes.

From type/IO/CatHandle

See Original text in context

method tell(IO::CatHandle:D: --> Int:D)

Calls .tell on the currently active source handle and returns the result. Returns Nil if the source handle queue may get exhausted.

(my $f1 = 'foo'.IO).spurt: 'foo';
(my $f2 = 'bar'.IO).spurt: 'bar';
 
with IO::CatHandle.new: $f1$f2 {
    .get.say;                   # OUTPUT: «foo␤» 
    .tell.say;                  # OUTPUT: «3␤» 
    .seek: -2SeekFromCurrent;
    .tell.say;                  # OUTPUT: «1␤» 
    say .readchars: 3;          # OUTPUT: «oob␤» 
    .tell.say;                  # OUTPUT: «2␤» 
    }