September 2001
Intermediate to advanced
768 pages
32h 45m
English
int ftell(resource file_handle) Retrieves the file pointer position.
Returns:
File pointer position; FALSE on error
Description:
Returns the current position of the file pointer in the file. The position is returned as a number of bytes.
Warning:
3.0.5: Unverified bug on SGI IRIX reporting an invalid file pointer after read operation.
Example:
$fh = fopen("test.txt", "r");
echo ("Current position: ". ftell($fh) ." bytes.<br />");
echo ("Character at this position: ". fgetc($fh) ."<br />");
// advance a few bytes
fseek($fh, 8);
echo ("New position: ". ftell($fh) ." bytes.<br />");
echo ("Character at this position: ". fgetc($fh));
fclose($fh);
|
Read now
Unlock full access