======fseek======
WMPRO, WMMINI FW >= 1.0 WMMEGA FW >= 2.0
Position the file pointer in an open file
====Description====
fseek (
int
$handle,
int
$offset,
int
$whence
)
This function will relocate the file pointer within an active file. Three different start position options are available.
====Parameters====
$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:
* **0** - Seek from the **start of the file**
* **1** - Seek from the **current position** (a positive offset will move forward, and a negative offset will move in reverse)
* **2** - Seek from the **end of the file** (in reverse)((When using whence=2 to seek from the end of the file a positive offset is used to move in reverse.))
====Return Values====
None
====Example====
$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");
}
?>
====See Also====
[[fopen()]] - Open a file for reading or writing
[[fseropen()]] - Open the serial port at the specified baud rate with optional parameters
[[f485open()]] - Open the RS-485 port at the specified baud rate and parity
[[fsockopen()]] - Open an internet socket connection with optional timeout
[[fread()]] - Read bytes from a file, stream or socket
[[fgets()]] - Return a single line from a file, stream or socket, with optional size limit
[[fwrite()]] - Write data to a file, stream or socket
[[feof()]] - Test if no more data is available in a file, stream or socket
[[filesize()]] - Return the size of a file, or the number of unread bytes in a stream or socket
[[ftell()]] - Return the current position of a file read/write pointer
[[fclose()]] - Close a file, stream or socket