Current Location: Home> Function Categories> ftell

ftell

Returns the location where the file pointer is read/write
Name:ftell
Category:File system
Programming Language:php
One-line Description:Returns the read/write position of the file pointer

Definition and usage

The current location of ftell() function in the open file.

This function returns the current location of the file pointer. If it fails, return false.

Example

 <?php
$file = fopen ( "test.txt" , "r" ) ;

// Output the current position
echo ftell ( $file ) ;

// Change the current position
fseek ( $file , "15" ) ;

// again output the current position
echo ftell ( $file ) ;

fclose ( $file ) ;
?>

Output:

 0
15

grammar

 ftell ( file )
parameter describe
file Required. Specifies the open files to be checked.

illustrate

The file pointer file must be valid and must point to a file that was successfully opened via fopen() or popen() .

In additional mode (adding parameter "a" to open the file) ftell() returns an undefined error.

Similar Functions
  • Read a line from a file pointer and filter out HTML tags fgetss

    fgetss

    Readalinefromafilepo
  • Get the file owner fileowner

    fileowner

    Getthefileowner
  • Format input from a file fscanf

    fscanf

    Formatinputfromafile
  • Get the inode modification time of the file filectime

    filectime

    Gettheinodemodificat
  • Returns the file path information pathinfo

    pathinfo

    Returnsthefilepathin
  • Read a line from the file pointer and parse the CSV field fgetcsv

    fgetcsv

    Readalinefromthefile
  • Provide information about the document stat

    stat

    Provideinformationab
  • Get file modification time filemtime

    filemtime

    Getfilemodificationt
Popular Articles