1ftell(3C) Standard C Library Functions ftell(3C)
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 obtains the current value of the file-position
19 indicator for the stream pointed to by stream. The ftello() function is
20 identical to ftell() except for the return type.
21
23 Upon successful completion, the ftell() and ftello() functions return
24 the current value of the file-position indicator for the stream mea‐
25 sured in bytes from the beginning of the file. Otherwise, they return
26 −1 and sets errno to indicate the error.
27
29 The ftell() and ftello() functions will fail if:
30
31 EBADF The file descriptor underlying stream is not an open file
32 descriptor.
33
34
35 ESPIPE The file descriptor underlying stream is associated with a
36 pipe, a FIFO, or a socket.
37
38
39
40 The ftell() function will fail if:
41
42 EOVERFLOW The current file offset cannot be represented correctly in
43 an object of type long.
44
45
46
47 The ftello() function will fail if:
48
49 EOVERFLOW The current file offset cannot be represented correctly in
50 an object of type off_t.
51
52
54 The ftello() function has a transitional interface for 64-bit file off‐
55 sets. See lf64(5).
56
58 See attributes(5) for descriptions of the following attributes:
59
60
61
62
63 ┌─────────────────────────────┬─────────────────────────────┐
64 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
65 ├─────────────────────────────┼─────────────────────────────┤
66 │Interface Stability │Standard │
67 ├─────────────────────────────┼─────────────────────────────┤
68 │MT-Level │MT-Safe │
69 └─────────────────────────────┴─────────────────────────────┘
70
72 lseek(2), fopen(3C), fseek(3C), attributes(5), , standards(5), lf64(5)
73
74
75
76SunOS 5.11 24 Jul 2002 ftell(3C)