1tell(3C) Standard C Library Functions tell(3C)
2
3
4
6 tell - return a file offset for a file descriptor
7
9 #include <unistd.h>
10
11 off_t tell(int fd);
12
13
15 The tell() function obtains the current value of the file-position
16 indicator for the file descriptor fd.
17
19 Upon successful completion, tell() returns the current value of the
20 file-position indicator for fd measured in bytes from the beginning of
21 the file.
22
23
24 Otherwise, it returns −1 and sets errno to indicate the error.
25
27 The tell() function will fail if:
28
29 EBADF The file descriptor fd is not an open file descriptor.
30
31
32 EOVERFLOW The current file offset cannot be represented correctly in
33 an object of type off_t.
34
35
36 ESPIPE The file descriptor fd is associated with a pipe or FIFO.
37
38
40 The tell() function is equivalent to lseek(fd, 0, SEEK_CUR).
41
43 See attributes(5) for descriptions of the following attributes:
44
45
46
47
48 ┌─────────────────────────────┬─────────────────────────────┐
49 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
50 ├─────────────────────────────┼─────────────────────────────┤
51 │MT-Level │MT-Safe │
52 └─────────────────────────────┴─────────────────────────────┘
53
55 lseek(2), attributes(5)
56
57
58
59SunOS 5.11 28 Jan 1998 tell(3C)