| 1 |
'\" t |
| 2 |
.\" Copyright 2001, Andries E. Brouwer <[email protected]> |
| 3 |
.\" Copyright, the authors of the Linux man-pages project |
| 4 |
.\" |
| 5 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 6 |
.\" |
| 7 |
.TH fseeko 3 2026-02-08 "Linux man-pages 6.18" |
| 8 |
.SH NAME |
| 9 |
fseeko, ftello \- seek to or report file position |
| 10 |
.SH LIBRARY |
| 11 |
Standard C library |
| 12 |
.RI ( libc ,\~ \-lc ) |
| 13 |
.SH SYNOPSIS |
| 14 |
.nf |
| 15 |
.B #include <stdio.h> |
| 16 |
.P |
| 17 |
.BI "int fseeko(FILE *" stream ", off_t " offset ", int " whence ); |
| 18 |
.BI "off_t ftello(FILE *" stream ); |
| 19 |
.fi |
| 20 |
.P |
| 21 |
.RS -4 |
| 22 |
Feature Test Macro Requirements for glibc (see |
| 23 |
.BR feature_test_macros (7)): |
| 24 |
.RE |
| 25 |
.P |
| 26 |
.BR fseeko (), |
| 27 |
.BR ftello (): |
| 28 |
.nf |
| 29 |
_FILE_OFFSET_BITS == 64 || _POSIX_C_SOURCE >= 200112L |
| 30 |
.fi |
| 31 |
.SH DESCRIPTION |
| 32 |
The |
| 33 |
.BR fseeko () |
| 34 |
and |
| 35 |
.BR ftello () |
| 36 |
functions are identical to |
| 37 |
.BR fseek (3) |
| 38 |
and |
| 39 |
.BR ftell (3) |
| 40 |
(see |
| 41 |
.BR fseek (3)), |
| 42 |
respectively, except that the |
| 43 |
.I offset |
| 44 |
argument of |
| 45 |
.BR fseeko () |
| 46 |
and the return value of |
| 47 |
.BR ftello () |
| 48 |
is of type |
| 49 |
.I off_t |
| 50 |
instead of |
| 51 |
.IR long . |
| 52 |
.P |
| 53 |
On some architectures, both |
| 54 |
.I off_t |
| 55 |
and |
| 56 |
.I long |
| 57 |
are 32-bit types, but defining |
| 58 |
.B _FILE_OFFSET_BITS |
| 59 |
with the value 64 (before including |
| 60 |
.I any |
| 61 |
header files) |
| 62 |
will turn |
| 63 |
.I off_t |
| 64 |
into a 64-bit type. |
| 65 |
.SH RETURN VALUE |
| 66 |
On successful completion, |
| 67 |
.BR fseeko () |
| 68 |
returns 0, while |
| 69 |
.BR ftello () |
| 70 |
returns the current offset. |
| 71 |
Otherwise, \-1 is returned and |
| 72 |
.I errno |
| 73 |
is set to indicate the error. |
| 74 |
.SH ERRORS |
| 75 |
See the ERRORS in |
| 76 |
.BR fseek (3). |
| 77 |
.SH ATTRIBUTES |
| 78 |
For an explanation of the terms used in this section, see |
| 79 |
.BR attributes (7). |
| 80 |
.TS |
| 81 |
allbox; |
| 82 |
lbx lb lb |
| 83 |
l l l. |
| 84 |
Interface Attribute Value |
| 85 |
T{ |
| 86 |
.na |
| 87 |
.nh |
| 88 |
.BR fseeko (), |
| 89 |
.BR ftello () |
| 90 |
T} Thread safety MT-Safe |
| 91 |
.TE |
| 92 |
.SH STANDARDS |
| 93 |
POSIX.1-2008. |
| 94 |
.SH HISTORY |
| 95 |
glibc 2.1. |
| 96 |
POSIX.1-2001, SUSv2. |
| 97 |
.SH NOTES |
| 98 |
The declarations of these functions can also be obtained by defining |
| 99 |
the obsolete |
| 100 |
.B _LARGEFILE_SOURCE |
| 101 |
feature test macro. |
| 102 |
.SH SEE ALSO |
| 103 |
.BR fseek (3) |