tell

Determines the current file position.

Library:LibC
Classification:Other
Service:File and Directory I/O

Syntax

  #include <fsio.h> 
   
  off_t tell (
     int   fildes);
  

Parameters

fildes

(IN) Specifies a file descriptor.

Return Values

If successful, returns the offset of the current file position relative to the beginning of the file. A value of zero indicates the start of the file.

If an error occurs, returns -1 and sets errno to one of the following:

Decimal

Constant

Description

4

EBADF

Invalid file descriptor.

33

ESPIPE

The file descriptor does not refer to a file.

Remarks

The fildes parameter is the file descriptor returned by a successful execution of the open, sopen, or creat. This function can be used in conjunction with lseek to reset the current file position.

See Also