explain_ftello_or_die(3)
π explain_ftello_or_die β bestie edition π
okay so this is a page from the Library Functions Manual, and it's about a little function called explain_ftello_or_die, which lowkey does exactly what it says on the tin: it gets your stream position, and if stuff goes wrong it tells you why and then dips. iconic behavior honestly.
β¨ NAME β¨
explain_ftello_or_die β get stream position and report errors
like. it gets the stream position. and it reports the errors. that's the whole vibe. no cap. π
πΈ SYNOPSIS πΈ
#include <libexplain/ftello.h>
off_t explain_ftello_or_die(FILE *fp);
off_t explain_ftello_on_error(FILE *fp);
two functions, one header, both taking a FILE *fp. it's giving duo. β¨
π¦ DESCRIPTION π¦
so here's the tea. π
The explain_ftello_or_die function is used to call the ftello(3) system call. On failure an explanation will be printed to stderr, obtained from the explain_ftello(3) function, and then the process terminates by calling exit(EXIT_FAILURE).
bestie. when it fails, it does not just sulk. it prints a whole explanation tostderrβ courtesy ofexplain_ftello(3)β and then it literally callsexit(EXIT_FAILURE). your process is GONE. main character exit. π
The explain_ftello_on_error function is used to call the ftello(3) system call. On failure an explanation will be printed to stderr, obtained from the explain_ftello(3) function, but still returns to the caller.
this one is the chill sibling π§ β same explanation printed tostderr, sameexplain_ftello(3)source, but it comes back to you. it does not leave. it stays. π«Ά
fpβ thefp, exactly as to be passed to theftello(3)system call. like, no edits, no remix, just hand it over as-is. π
π RETURN VALUE π
The explain_ftello_or_die function only returns on success, see ftello(3) for more information. On failure, prints an explanation and exits, it does not return.
read that again bestie: it does not return. success only. anything else and you're getting escorted out of the building by exit. π
The explain_ftello_on_error function always returns the value return by the wrapped ftello(3) system call.
"always returns the value return by" β yes, that's the original wording, we're keeping it fr fr, it just means it hands you back whatever the wrapped ftello(3) gave. π
β EXAMPLE β
The explain_ftello_or_die function is intended to be used in a fashion similar to the following example:
off_t result = explain_ftello_or_die(fp);
one line. that's it. that's the whole demonstration. ate and left no crumbs. π₯
π SEE ALSO π
ftello(3)β get stream positionexplain_ftello(3)β explainftello(3)errorsexit(2)β terminate the calling process
the whole squad, assembled. π
π COPYRIGHT π
libexplain version 1.4 Copyright (C) 2013 Peter Miller
and that's the page, bestie π this whole thing lives in libexplain version 1.4, copyrighted (C) 2013 Peter Miller, and it's the explain_ftello_or_die(3) entry in the Library Functions Manual. go get that stream position. slay. π
β¨
π¦ where this page comes from
- debian bookworm: libexplain-dev 1.4.D001-12+b1 Β· LGPL-3.0-or-later
- debian trixie: libexplain-dev 1.4.D001-16 Β· LGPL-3.0-or-later
- ubuntu jammy: libexplain-dev 1.4.D001-12 Β· LGPL-3.0-or-later
- ubuntu noble: libexplain-dev 1.4.D001-13 Β· LGPL-3.0-or-later
- ubuntu resolute: libexplain-dev 1.4.D001-16 Β· LGPL-3.0-or-later
- Copyright (C) 2013 Peter Miller
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms