The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group

 NAME

ftell, ftello - return a file offset in a stream

 SYNOPSIS



#include <stdio.h>

long int ftell(FILE *stream);
off_t ftello(FILE *stream);

 DESCRIPTION

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.

 RETURN VALUE

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.

 ERRORS

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.

 EXAMPLES

None.

 APPLICATION USAGE

None.

 FUTURE DIRECTIONS

None.

 SEE ALSO

fgetpos(), fopen(), fseek(), ftello(), lseek(), <stdio.h>, and the XNS specification description of ftell().

DERIVATION

Derived from Issue 1 of the SVID.

UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]