ftell(), ftello(), ftello64()

return the current position of a stream's file pointer 

Function


SYNOPSIS

#include <stdio.h>

long ftell(FILE *stream);

off_t ftello(FILE *stream);

off64_t ftello64(FILE *stream);


DESCRIPTION

The ftell() function returns the current position of the file pointer in a stream.

The ftello() function is identical to ftell() except for the return type.

The ftello64() function is identical to the ftello() function except that it is able to return file offsets that are greater than 2 gigabytes. The ftello64() function is a part of the large file extensions.


PARAMETERS

stream 

Points to a stream whose current position is desired.


RETURN VALUES

If successful, the ftell() and ftello() functions return the current file position for the stream, measured in bytes from the beginning of the file. On failure, they return -1 and and errno is set to one of the following values:

EBADF 

The file descriptor underlying stream is not valid.

EOVERFLOW 

The current file offset cannot be represented correctly in an object with the specified return type.

ESPIPE 

The file descriptor underlying stream is associated with a pipe or FIFO.


CONFORMANCE

ANSI/ISO 9899-1990.

ftello(), ftello64(): Large File Specification, revision 1.5.


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

The file positions reported by fgetpos(), ftell(), or ftello() may be incorrect for files that are open in text mode in the case that the file is being read, or the case where the file is being written to and there is buffered data which has not yet been written to the underlying file. In the case that the file is being written to, fflush() can be used prior to calling fgetpos(), ftell(), or ftello() to ensure the accuracy of these functions. Text mode files with no buffering do not have this problem; however, performance can be significantly degraded with buffering turned off.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
fopen(), fseek(), lseek(), popen(), rewind(), ungetc(), write()

Miscellaneous:
lf64


PTC MKS Toolkit 10.4 Documentation Build 39.