Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

sysseek

Repositions the OS file pointer, bypassing Perl’s buffered I/O layer.

Calls lseek(2) on the underlying file descriptor to reposition the read/write offset. Unlike seek, this operates at the system-call level and does not interact with Perl’s I/O buffering.

Returns the resulting absolute position (as a “0 but true” string when the position is zero, per perl5 convention), or undef on error (with $! set).

Warning: Do not mix sysseek with buffered I/O (seek, tell) on the same filehandle.

Synopsis

$pos = sysseek($fh, $offset, SEEK_SET);  # absolute
$pos = sysseek($fh, 0, SEEK_CUR);        # query position
$pos = sysseek($fh, 0, SEEK_END);        # query file size

See Also

seek, tell, sysread, syswrite