1STDIN(P) POSIX Programmer's Manual STDIN(P)
2
3
4
6 stderr, stdin, stdout - standard I/O streams
7
9 #include <stdio.h>
10
11 extern FILE *stderr, *stdin, *stdout;
12
13
15 A file with associated buffering is called a stream and is declared to
16 be a pointer to a defined type FILE. The fopen() function shall create
17 certain descriptive data for a stream and return a pointer to designate
18 the stream in all further transactions. Normally, there are three open
19 streams with constant pointers declared in the <stdio.h> header and
20 associated with the standard open files.
21
22 At program start-up, three streams shall be predefined and need not be
23 opened explicitly: standard input (for reading conventional input),
24 standard output (for writing conventional output), and standard error
25 (for writing diagnostic output). When opened, the standard error stream
26 is not fully buffered; the standard input and standard output streams
27 are fully buffered if and only if the stream can be determined not to
28 refer to an interactive device.
29
30 The following symbolic values in <unistd.h> define the file descriptors
31 that shall be associated with the C-language stdin, stdout, and stderr
32 when the application is started:
33
34 STDIN_FILENO
35 Standard input value, stdin. Its value is 0.
36
37 STDOUT_FILENO
38 Standard output value, stdout. Its value is 1.
39
40 STDERR_FILENO
41 Standard error value, stderr. Its value is 2.
42
43
44 The stderr stream is expected to be open for reading and writing.
45
47 None.
48
50 No errors are defined.
51
52 The following sections are informative.
53
55 None.
56
58 None.
59
61 None.
62
64 None.
65
67 fclose() , feof() , ferror() , fileno() , fopen() , fread() , fseek() ,
68 getc() , gets() , popen() , printf() , putc() , puts() , read() ,
69 scanf() , setbuf() , setvbuf() , tmpfile() , ungetc() , vprintf() , the
70 Base Definitions volume of IEEE Std 1003.1-2001, <stdio.h>, <unistd.h>
71
73 Portions of this text are reprinted and reproduced in electronic form
74 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
75 -- Portable Operating System Interface (POSIX), The Open Group Base
76 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
77 Electrical and Electronics Engineers, Inc and The Open Group. In the
78 event of any discrepancy between this version and the original IEEE and
79 The Open Group Standard, the original IEEE and The Open Group Standard
80 is the referee document. The original Standard can be obtained online
81 at http://www.opengroup.org/unix/online.html .
82
83
84
85IEEE/The Open Group 2003 STDIN(P)