The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group


stderr, stdin, stdout - standard I/O streams


#include <stdio.h>

extern FILE *stderr, *stdin, *stdout;


A file with associated buffering is called a stream and is declared to be a pointer to a defined type FILE. The fopen() function creates certain descriptive data for a stream and returns 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 associated with the standard open files.

At program startup, three streams are predefined and need not be opened explicitly: standard input (for reading conventional input), standard output (for writing conventional output) and 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.

The following symbolic values in <unistd.h> define the file descriptors that will be associated with the C-language stdin, stdout and stderr when the application is started:

Standard input value, stdin. Its value is 0.
Standard output value, stdout. Its value is 1.
Standard error value, stderr. Its value is 2.




No errors are defined.








fclose(), feof(), ferror(), fileno(), fopen(), fread(), fseek(), getc(), gets(), popen(), printf(), putc(), puts(), read(), scanf(), setbuf(), setvbuf(), tmpfile(), ungetc(), vprintf(), <stdio.h>, <unistd.h>.

UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]