Perl sysseek 函式



描述

此函式根據 POSITION 和 WHENCE 的值來設定 FILEHANDLE 中的位置。

這相當於 C 函式 lseek( ),因此您應避免在 FILEHANDLE 的緩衝形式中使用它。這包括 FILEHANDLE 符號以及 print、write、seek 和 tell。與 sysread 或 syswrite 一起使用是可以的,因為它們也會忽略緩衝。

檔案中的位置由 POSITION 指定,使用 WHENCE 的值作為參考點,如下表所示。

EEK_SET -> 0
Sets the new position absolutely to POSITION bytes
within the file

SEEK_CUR -> 1
Sets the new position to the current position plus
POSITION bytes within the file

SEEK_END -> 2
Sets the new position to POSITION bytes, relative to
the end of the file

語法

以下為此函式的簡單語法 -

sysseek FILEHANDLE,POSITION,WHENCE

返回值

此函式在失敗時返回未定義,將 0 的位置返回為字串 0 但為真和整數,成功時返回新位置(以位元組為單位)。

perl_function_references.htm
廣告