STDIN(3P)
๐ STDIN(3P) โ bestie edition ๐
okay so welcome to the POSIX Programmer's Manual, specifically the page for stdin, stdout, and stderr โ the three streams that literally run your whole life and you probably never think about them. this is STDIN(3P) from the POSIX Programmer's Manual, and we're gonna go through it together, no cap. ๐
โจ PROLOG โจ
real talk first: this manual page is part of the POSIX Programmer's Manual. the Linux implementation of this interface may differ โ so if you're on Linux, go consult the corresponding Linux manual page for the actual tea. or, honestly, the interface might not even be implemented on Linux at all. ๐ซ
๐ธ NAME ๐ธ
stderr, stdin, stdout โ standard I/O streams. the holy trinity. the main characters. ๐
โจ SYNOPSIS โจ
#include <stdio.h>
extern FILE *stderr, *stdin, *stdout;
that's it. that's the whole vibe. three pointers, endless power. ๐
๐ฆ DESCRIPTION ๐ฆ
okay so the functionality described on this reference page is aligned with the ISO C standard. and listen โ any conflict between the requirements described here and the ISO C standard is unintentional, fr fr. this volume of POSIX.1โ2017 defers to the ISO C standard, periodt.
A file with associated buffering is called a stream, and it's declared to be a pointer to a defined type FILE. the fopen() function shall create certain descriptive data for a stream and return a pointer to designate the stream in all further transactions. normally, there are three open streams with constant pointers declared in the <stdio.h> header, and they're associated with the standard open files. iconic behaviour honestly.
At program start-up, three streams shall be predefined and need not be opened explicitly:
- standard input (for reading conventional input) ๐ฅ
- standard output (for writing conventional output) ๐ค
- standard error (for writing diagnostic output) ๐จ
when opened, the standard error stream is not fully buffered. the standard input and standard output streams are fully buffered if and only if the stream can be determined not to refer to an interactive device. so like, if it's a terminal, no full buffering for you bestie. ๐ง
The following symbolic values in <unistd.h> define the file descriptors that shall be associated with the C-language stdin, stdout, and stderr when the application is started:
STDIN_FILENOโ standard input value,stdin. its value is0. ๐STDOUT_FILENOโ standard output value,stdout. its value is1. โญSTDERR_FILENOโ standard error value,stderr. its value is2. ๐
zero, one, two. that's the whole file descriptor starter pack. remember it forever, iykyk.
The stderr stream is expected to be open for reading and writing. yes, reading and writing. both. she's versatile. ๐
๐ RETURN VALUE ๐
None. nothing. not a single thing to return. she gives nothing and that's fine. ๐
๐ ERRORS ๐
No errors are defined.
also: the following sections are informative. so like, they're the bonus content, not the binding lore. โจ
๐ EXAMPLES ๐
None. (i know. we were all hoping.) ๐ญ
๐ซถ APPLICATION USAGE ๐ซถ
None.
๐ง RATIONALE ๐ง
None.
๐ฎ FUTURE DIRECTIONS ๐ฎ
None.
๐ SEE ALSO ๐
the whole friend group:
fclose(), feof(), ferror(), fileno(), fopen(), fprintf(), fread(), fscanf(), fseek(), getc(), gets(), popen(), putc(), puts(), read(), setbuf(), setvbuf(), tmpfile(), ungetc(), vfprintf()
also the Base Definitions volume of POSIX.1โ2017: <stdio.h>, <unistd.h>. go read those, bestie, they're lowkey essential. ๐
โ๏ธ 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 .
and that's the whole page, bestie!! ๐โจ๐๐ฆ๐ธ
this little love letter to file descriptors came to you courtesy of IEEE/The Open Group, dated 2017, and it lives under the name STDIN(3P). go forth and printf() responsibly. periodt. ๐
๐๐
๐ฆ 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