1FTELL(P) POSIX Programmer's Manual FTELL(P)
2
3
4
6 ftell, ftello - return a file offset in a stream
7
9 #include <stdio.h>
10
11 long ftell(FILE *stream);
12
13
14 off_t ftello(FILE *stream);
15
16
18 The ftell() function shall obtain the current value of the file-posi‐
19 tion indicator for the stream pointed to by stream.
20
21 The ftello() function shall be equivalent to ftell(), except that the
22 return value is of type off_t.
23
25 Upon successful completion, ftell() and ftello() shall return the
26 current value of the file-position indicator for the stream measured in
27 bytes from the beginning of the file.
28
29 Otherwise, ftell() and ftello() shall return -1, cast to long and
30 off_t respectively, and set errno to indicate the error.
31
33 The ftell() and ftello() functions shall fail if:
34
35 EBADF The file descriptor underlying stream is not an open file
36 descriptor.
37
38 EOVERFLOW
39 For ftell(), the current file offset cannot be represented cor‐
40 rectly in an object of type long.
41
42 EOVERFLOW
43 For ftello(), the current file offset cannot be represented cor‐
44 rectly in an object of type off_t.
45
46 ESPIPE The file descriptor underlying stream is associated with a pipe
47 or FIFO.
48
49
50 The ftell() function may fail if:
51
52 ESPIPE The file descriptor underlying stream is associated with a
53 socket.
54
55
56 The following sections are informative.
57
59 None.
60
62 None.
63
65 None.
66
68 None.
69
71 fgetpos() , fopen() , fseek() , lseek() , the Base Definitions volume
72 of IEEE Std 1003.1-2001, <stdio.h>
73
75 Portions of this text are reprinted and reproduced in electronic form
76 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
77 -- Portable Operating System Interface (POSIX), The Open Group Base
78 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
79 Electrical and Electronics Engineers, Inc and The Open Group. In the
80 event of any discrepancy between this version and the original IEEE and
81 The Open Group Standard, the original IEEE and The Open Group Standard
82 is the referee document. The original Standard can be obtained online
83 at http://www.opengroup.org/unix/online.html .
84
85
86
87IEEE/The Open Group 2003 FTELL(P)