Open System Services Library Calls Reference Manual (G06.27+, H06.04+)

Miscellaneous stdin(5)
NAME
stderr, stdin, stdout - Standard I/O streams
SYNOPSIS
#include <stdio.h>
extern FILE
*stderr, *stdin, *stdout;
DESCRIPTION
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 con-
stant 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 (refer to setvbuf(3)); 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 C-language stdin, stdout, and stderr when the application is started:
STDIN_FILENO
Standard input value, stdin. It has a value of zero.
STDOUT_FILENO
Standard output value, stdout. It has a value of one.
STDERR_FILENO
Standard error value, stderr. It has a value of two.
RELATED INFORMATION
fclose(3), feof(3), ferror(3), fileno(3), fopen(3), fread(3), fseek(3), getc(3), gets(3), popen(3),
printf(3), putc(3), puts(3), read(2), scanf(3), setbuf(3), tmpfile(3), ungetc(3), vprintf(3).
527187-004 Hewlett-Packard Company 93