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
19
21 A file with associated buffering is called a stream and is declared to
22 be a pointer to a defined type FILE. The fopen() function shall create
23 certain descriptive data for a stream and return a pointer to designate
24 the stream in all further transactions. Normally, there are three open
25 streams with constant pointers declared in the <stdio.h> header and
26 associated with the standard open files.
27
28 At program start-up, three streams shall be predefined and need not be
29 opened explicitly: standard input (for reading conventional input),
30 standard output (for writing conventional output), and standard error
31 (for writing diagnostic output). When opened, the standard error stream
32 is not fully buffered; the standard input and standard output streams
33 are fully buffered if and only if the stream can be determined not to
34 refer to an interactive device.
35
36 The following symbolic values in <unistd.h> define the file descriptors
37 that shall be associated with the C-language stdin, stdout, and stderr
38 when the application is started:
39
40 STDIN_FILENO
41 Standard input value, stdin. Its value is 0.
42
43 STDOUT_FILENO
44 Standard output value, stdout. Its value is 1.
45
46 STDERR_FILENO
47 Standard error value, stderr. Its value is 2.
48
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(), fread(), fseek(),
74 getc(), gets(), popen(), printf(), putc(), puts(), read(), scanf(),
75 setbuf(), setvbuf(), tmpfile(), ungetc(), vprintf(), the Base Definiā
76 tions volume of IEEE Std 1003.1-2001, <stdio.h>, <unistd.h>
77
79 Portions of this text are reprinted and reproduced in electronic form
80 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
81 -- Portable Operating System Interface (POSIX), The Open Group Base
82 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
83 Electrical and Electronics Engineers, Inc and The Open Group. In the
84 event of any discrepancy between this version and the original IEEE and
85 The Open Group Standard, the original IEEE and The Open Group Standard
86 is the referee document. The original Standard can be obtained online
87 at http://www.opengroup.org/unix/online.html .
88
89
90
91IEEE/The Open Group 2003 STDIN(3P)