ftell, ftello - return a file offset in a stream
#include <stdio.h> long int ftell(FILE *stream); off_t ftello(FILE *stream);
The ftell() function obtains the current value of the file-position indicator for the stream pointed to by stream.The ftello() function is identical to ftell() except that the return value is of type off_t.
Upon successful completion, ftell() and ftello() return the current value of the file-position indicator for the stream measured in bytes from the beginning of the file.Otherwise, ftell() and ftello() return -1, cast to long and off_t respectively, and set errno to indicate the error.
The ftell() and ftello() functions will fail if:
- [EBADF]
- The file descriptor underlying stream is not an open file descriptor.
- [EOVERFLOW]
- For ftell(), the current file offset cannot be represented correctly in an object of type long.
- [EOVERFLOW]
- For ftello(), the current file offset cannot be represented correctly in an object of type off_t.
- [ESPIPE]
- The file descriptor underlying stream is associated with a pipe or FIFO.
None.
None.
None.
fgetpos(), fopen(), fseek(), ftello(), lseek(), <stdio.h>, and the XNS specification description of ftell().
Derived from Issue 1 of the SVID.