FGETPOS(3P)
π FGETPOS(3P) π
okay so this one lives in the POSIX Programmer's Manual, bestie, and it's the whole fgetpos situation. quick heads up before we dive in π
πΈ PROLOG πΈ
so like, this manual page is part of the POSIX Programmer's Manual. that's the vibe. but β and this is important β the Linux implementation of this interface may differ, so if you're on Linux, go consult the corresponding Linux manual page for the deets on Linux behavior. or honestly, the interface might not even be implemented on Linux at all. no cap. π«Ά
β¨ NAME β¨
fgetpos β get current file position information π
π SYNOPSIS π
#include <stdio.h>
int fgetpos(FILE *restrict stream, fpos_t *restrict pos);
π¦ DESCRIPTION π¦
okay so first things first: everything described on this reference page is aligned with the ISO C standard. if there's any conflict between what's written here and the ISO C standard, that conflict is unintentional β not on purpose, not a vibe. this volume of POSIX.1β2017 defers to the ISO C standard. periodt. π
so what does fgetpos() actually do? it shall store the current values of the parse state (if any) and the file position indicator for the stream pointed to by stream into the object pointed to by pos. iconic.
and the value it stores? it contains unspecified information β usable by fsetpos() for repositioning the stream back to its position at the time of the call to fgetpos(). so like, it's a lil bookmark π you hand back to fsetpos() later. you don't need to know what's inside it, iykyk.
also very important bestie: the fgetpos() function shall not change the setting of errno if successful. not touching it. leaving errno exactly how it found it. respectful. π
π RETURN VALUE π
- upon successful completion,
fgetpos()shall return0π - otherwise, it shall return a non-zero value and set
errnoto indicate the error π
π₯ ERRORS π₯
the fgetpos() function shall fail if:
EBADFβ the file descriptor underlying stream is not valid. πEOVERFLOWβ the current value of the file position cannot be represented correctly in an object of typefpos_t. like it literally doesn't fit, sorry bestie πESPIPEβ the file descriptor underlying stream is associated with a pipe, FIFO, or socket. pipes don't do positions, that's just the rules. π«
heads up: the following sections are informative. they're the vibes, not the requirements. β¨
π EXAMPLES π
None. (yes really, nothing here, we move πββοΈ)
πΈ APPLICATION USAGE πΈ
None. (also nothing, iconic of them honestly)
β RATIONALE β
None. (empty, but make it fashion)
π FUTURE DIRECTIONS π
None. (the future is a mystery, but not here specifically)
π SEE ALSO π
- Section 2.5, Standard I/O Streams
fopen()ftell()rewind()ungetc()- The Base Definitions volume of POSIX.1β2017,
<stdio.h>
π COPYRIGHT π
okay so legally I have to say this and I'm gonna say it with love:
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 .
and that's the whole page bestie!! mwah π this one came from IEEE/The Open Group, dated 2017 β thanks for reading, ily, go call fgetpos() responsibly π«Άβ¨
π¦ where this page comes from
- alpine 3.22: man-pages-posix 2017a-r0 Β· custom
- alpine 3.23: man-pages-posix 2017a-r0 Β· custom
- alpine 3.24: man-pages-posix 2017a-r0 Β· custom
- arch rolling: man-pages 6.19-1
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages-posix 2017a
- opensuse-leap 16.0: man-pages-posix 2017a-160000.4.1 Β· SUSE-IEEE
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms