1FTELL(3P)                  POSIX Programmer's Manual                 FTELL(3P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10
11

NAME

13       ftell, ftello — return a file offset in a stream
14

SYNOPSIS

16       #include <stdio.h>
17
18       long ftell(FILE *stream);
19       off_t ftello(FILE *stream);
20

DESCRIPTION

22       The functionality described on this reference page is aligned with  the
23       ISO C  standard.  Any  conflict between the requirements described here
24       and the ISO C standard is unintentional. This  volume  of  POSIX.1‐2008
25       defers to the ISO C standard.
26
27       The  ftell()  function shall obtain the current value of the file-posi‐
28       tion indicator for the stream pointed to by stream.
29
30       The ftell() function shall not change the setting of errno if  success‐
31       ful.
32
33       The  ftello()  function shall be equivalent to ftell(), except that the
34       return value is of type off_t and the ftello() function may change  the
35       setting of errno if successful.
36

RETURN VALUE

38       Upon  successful completion, ftell() and ftello() shall return the cur‐
39       rent value of the file-position indicator for the  stream  measured  in
40       bytes from the beginning of the file.
41
42       Otherwise, ftell() and ftello() shall return −1, and set errno to indi‐
43       cate the error.
44

ERRORS

46       The ftell() and ftello() functions shall fail if:
47
48       EBADF  The file descriptor  underlying  stream  is  not  an  open  file
49              descriptor.
50
51       EOVERFLOW
52              For  ftell(), the current file offset cannot be represented cor‐
53              rectly in an object of type long.
54
55       EOVERFLOW
56              For ftello(), the current file offset cannot be represented cor‐
57              rectly in an object of type off_t.
58
59       ESPIPE The file descriptor underlying stream is associated with a pipe,
60              FIFO, or socket.
61
62       The following sections are informative.
63

EXAMPLES

65       None.
66

APPLICATION USAGE

68       None.
69

RATIONALE

71       None.
72

FUTURE DIRECTIONS

74       None.
75

SEE ALSO

77       Section 2.5, Standard I/O Streams, fgetpos(), fopen(), fseek(), lseek()
78
79       The Base Definitions volume of POSIX.1‐2008, <stdio.h>
80
82       Portions of this text are reprinted and reproduced in  electronic  form
83       from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
84       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
85       Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
86       cal and Electronics Engineers,  Inc  and  The  Open  Group.   (This  is
87       POSIX.1-2008  with  the  2013  Technical Corrigendum 1 applied.) In the
88       event of any discrepancy between this version and the original IEEE and
89       The  Open Group Standard, the original IEEE and The Open Group Standard
90       is the referee document. The original Standard can be  obtained  online
91       at http://www.unix.org/online.html .
92
93       Any  typographical  or  formatting  errors that appear in this page are
94       most likely to have been introduced during the conversion of the source
95       files  to  man page format. To report such errors, see https://www.ker
96       nel.org/doc/man-pages/reporting_bugs.html .
97
98
99
100IEEE/The Open Group                  2013                            FTELL(3P)
Impressum