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