Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

ftell, ftell64, ftello, ftello64 - get current value of file position indicator for stream

&pagelevel(4)&pagelevel

Description

These functions obtain the current value of the file position indicator for the streampointed to by stream.
This value can be used for positioning with fseek()/fseeko().

The ftello() function is the same as the modified ftell() function except that the offset
argument is of type off_t and that the EOVERFLOW error has changed.

There is no difference in functionality between ftell() and ftell64() except that
ftell64() uses the offset type long long.

ftello64() defined like ftello() except that ftello64() uses the offset type off64_t.

Return val.

current value of the file position indicator 



for the stream, i.e. the number of bytes that offsets the file position indicator from the beginning of the file, if successful.

 

-1

if an error occurs; errno is set to indicate the error.

 

BS2000 

current value of the file position indicator  

 


i.e. the number of bytes that offsets the file position indicator from the beginning of the file, if successful.

 

absolute position of the file position indicator  

 


for text files, if successful.

 

-1

if an error occurs; errno is set to ERANGE if the file position cannot be represented in 4 bytes. (End)

Errors

ftell(), ftell64(), ftello() and ftello64() will fail if: 

 

EBADF

The file descriptor underlying stream is not open for writing or the stream's buffer needed to be flushed and the file is not open.

 

ESPIPE

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

 

EOVERFLOW

For ftell(): the resulting file offset is a value that 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.

Notes

The program environment determines whether ftell() / ftello() is executed for a BS2000 or POSIX file.

BS2000
ftell() can be used on both binary files (SAM in binary mode, PAM, INCORE) as well as text files (SAM in text mode, ISAM).

ftell() cannot be used for system files (SYSDTA, SYSLST, SYSOUT). (End)

See also

fopen(), fseek(), lseek(), stdio.h.