ftell()
Return the file position indicator
Syntax
Parameter
Parameter | Definition |
---|---|
channel | file I/O channel returned when the file was opened by the fopen() function |
Description
The ftell() function returns the file position indicator as the integer number of bytes from the beginning of the file. For an invalid channel, that is, a pipe channel instead of a file channel, the ftell() function returns -1, raises a run-time error, and sets the PSL errno variable.
The typical result of both the C and PSL versions of the ftell() function is the number of characters written to or read from a file, except on those platforms that perform CR/LF ¤ new-line conversions on text files. However, the value of theftell() function after executing an fseek() function to the end of file is usually the total number of characters in the file.
The following PSL functions change the file position indicator:
- fopen()
- fseek()
- read()
- readln()
- write()
The get_chan_info() function does not change the file position indicator. The close() function makes channel invalid.
Example
This function call returns the current file position indicator for the chan channel: