Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

stderr, stdin, stdout - variables for standard I/O streams

&pagelevel(4)&pagelevel

Syntax

#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 that stream in all further transactions.

There are three data streams which are predefined at program startup and need not be opened explicitly (see stdio.h):

 

stdin

Standard input, for reading conventional input.

 

stdout

Standard output, for writing conventional output.

 

stderr

Standard error, for the output of diagnostic and error messages.

 

When opened, the standard error stream is not fully buffered (see setvbuf()); the standard input and standard output streams are fully buffered if and only if the stream is not associated with an interactive device.

The following symbolic values in unistd.h define the file descriptors assigned to the data streams stdin, stdout and stderr when the application is started:

STDIN_FILENO

File descriptor for standard input, stdin. Its value is 0.

STDOUT_FILENO

File descriptor for standard output, stdout. Its value is 1.

STDERR_FILENO

File descriptor for standard error, stderr. Its value is 2.

See also

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