This is an old revision of the document!
WMPRO, WMMINI FW >= 1.0 WMMEGA FW >= 2.0
Position the file pointer in an open file
This function will relocate the file pointer within an active file. Three different start position options are available.
$handle: Valid handle of a previously opened file
$offset: How far to move the pointer (bytes)
$whence: Seek type, starting position option, from where to move the pointer:
None
<? $fp=fopen("/index.cgi","r"); if ($fp) { fseek($fp,10,2); // position to 10 characters before the end of the file $data=fread($fp,10); print($data); fclose($fp); } else { print("File open failed\n"); } ?>
fopen() - Open a file for reading or writing
fread() - Return bytes from a file or stream
fgets() - Return a single line from a file or stream, with optional size limit
fwrite() - Write data to a file or stream
ftell() - Return the current position of the file read/write pointer
fclose() - Close a file, stream or socket