1STDIN(3P) POSIX Programmer's Manual STDIN(3P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
12 stderr, stdin, stdout — standard I/O streams
13
15 #include <stdio.h>
16
17 extern FILE *stderr, *stdin, *stdout;
18
20 The functionality described on this reference page is aligned with the
21 ISO C standard. Any conflict between the requirements described here
22 and the ISO C standard is unintentional. This volume of POSIX.1‐2017
23 defers to the ISO C standard.
24
25 A file with associated buffering is called a stream and is declared to
26 be a pointer to a defined type FILE. The fopen() function shall create
27 certain descriptive data for a stream and return a pointer to designate
28 the stream in all further transactions. Normally, there are three open
29 streams with constant pointers declared in the <stdio.h> header and
30 associated with the standard open files.
31
32 At program start-up, three streams shall be predefined and need not be
33 opened explicitly: standard input (for reading conventional input),
34 standard output (for writing conventional output), and standard error
35 (for writing diagnostic output). When opened, the standard error stream
36 is not fully buffered; the standard input and standard output streams
37 are fully buffered if and only if the stream can be determined not to
38 refer to an interactive device.
39
40 The following symbolic values in <unistd.h> define the file descriptors
41 that shall be associated with the C-language stdin, stdout, and stderr
42 when the application is started:
43
44 STDIN_FILENO Standard input value, stdin. Its value is 0.
45
46 STDOUT_FILENO Standard output value, stdout. Its value is 1.
47
48 STDERR_FILENO Standard error value, stderr. Its value is 2.
49
50 The stderr stream is expected to be open for reading and writing.
51
53 None.
54
56 No errors are defined.
57
58 The following sections are informative.
59
61 None.
62
64 None.
65
67 None.
68
70 None.
71
73 fclose(), feof(), ferror(), fileno(), fopen(), fprintf(), fread(),
74 fscanf(), fseek(), getc(), gets(), popen(), putc(), puts(), read(),
75 setbuf(), setvbuf(), tmpfile(), ungetc(), vfprintf()
76
77 The Base Definitions volume of POSIX.1‐2017, <stdio.h>, <unistd.h>
78
80 Portions of this text are reprinted and reproduced in electronic form
81 from IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
82 table Operating System Interface (POSIX), The Open Group Base Specifi‐
83 cations Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of
84 Electrical and Electronics Engineers, Inc and The Open Group. In the
85 event of any discrepancy between this version and the original IEEE and
86 The Open Group Standard, the original IEEE and The Open Group Standard
87 is the referee document. The original Standard can be obtained online
88 at http://www.opengroup.org/unix/online.html .
89
90 Any typographical or formatting errors that appear in this page are
91 most likely to have been introduced during the conversion of the source
92 files to man page format. To report such errors, see https://www.ker‐
93 nel.org/doc/man-pages/reporting_bugs.html .
94
95
96
97IEEE/The Open Group 2017 STDIN(3P)