fseek

(FW >= 1.0)

fseek - Change position in an open file

Description

int fseek( int $handle, int $offset, int $seek_type )

This will relocate the file pointer within an active file.  Three different position options are available.

Parameters

handle

handle of open file

offset

The offset to set the position to - this will depend on the $seek_type variable

seek_type

If seek_type is 0, the position will be set in relation to the beginning of the file.
If seek_type is 1, the position will be set relative to the current position
If seek_type is 2, the position will be set relative to the end of the file.

Return Value

none

Examples

<? 
$fp = fopen("/index.cgi","r");
if (!$fp) {
    print("File open failed\n");
} else {
fseek($fp,10, 2); // position to 10 characters before the end of the file
$data=fread($fp,10);
print($data); fclose($fp); } ?>