FTELL(3POSIX)
πΈ FTELL π
okay so bestie, we're in the POSIX Programmer's Manual rn β this is FTELL(3POSIX), and I need you to know that the Linux version of this interface might act a little different (so like, go check the matching Linux manual page for the tea, fr fr), or honestly it might not even be implemented on Linux at all. π
β¨ PROLOG β¨
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux.
ngl this is the "your mileage may vary" disclaimer and it is so real. π«Ά
π NAME π
ftell, ftello β return a file offset in a stream
π SYNOPSIS π
#include <stdio.h>
long ftell(FILE *stream);
off_t ftello(FILE *stream);
π¦ DESCRIPTION π¦
The functionality described on this reference page is aligned with the ISO C standard. Any conflict between the requirements described here and the ISO C standard is unintentional. This volume of POSIX.1β2017 defers to the ISO C standard. periodt.
The ftell() function shall obtain the current value of the file-position indicator for the stream pointed to by stream.
The ftell() function shall not change the setting of errno if successful. like, it's polite, it minds its business. π
The ftello() function shall be equivalent to ftell(), except that the return value is of type off_t and the ftello() function may change the setting of errno if successful. so like, same energy, different return type, and it's a lil messier with errno. π
π RETURN VALUE π
Upon successful completion, ftell() and ftello() shall return the current value of the file-position indicator for the stream measured in bytes from the beginning of the file.
Otherwise, ftell() and ftello() shall return -1, and set errno to indicate the error.
not the -1 jump scare π
π₯ ERRORS π₯
The ftell() and ftello() functions shall fail if:
EBADFβ The file descriptor underlyingstreamis not an open file descriptor. it's giving "who even are you" πEOVERFLOWβ Forftell(), the current file offset cannot be represented correctly in an object of typelong.EOVERFLOWβ Forftello(), the current file offset cannot be represented correctly in an object of typeoff_t.ESPIPEβ The file descriptor underlyingstreamis associated with a pipe, FIFO, or socket. pipes are not it for seeking bestie, sorry π₯²
The following sections are informative.
π EXAMPLES π
None.
π APPLICATION USAGE π
None.
π§ RATIONALE π§
None.
β FUTURE DIRECTIONS β
None.
π SEE ALSO π
Section 2.5, Standard I/O Streams, fgetpos(), fopen(), fseek(), lseek()
The Base Definitions volume of POSIX.1β2017, <stdio.h>
πΈ COPYRIGHT πΈ
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .
Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .
okay that's the whole page bestie, no cap, every last option and caveat is in there π«Ά shoutout to IEEE/The Open Group for this absolute banger from 2017 β you ate and left no crumbs, mwah π β¨
π¦ where this page comes from
- debian bookworm: manpages-posix-dev 2017a-2 Β· Other
- debian trixie: manpages-posix-dev 2017a-2 Β· Other
- ubuntu jammy: manpages-posix-dev 2017a-2 Β· Other
- ubuntu noble: manpages-posix-dev 2017a-2 Β· Other
- ubuntu resolute: manpages-posix-dev 2017a-2build1 Β· Other
- ubuntu stonking: manpages-posix-dev 2017a-2.1 Β· Other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms