main function of your program is invoked, it already has
three predefined streams open and available for use. These represent
the “standard” input and output channels that have been established
for the process.
These streams are declared in the header file stdio.h.
The standard input stream, which is the normal source of input for the program.
The standard output stream, which is used for normal output from the program.
The standard error stream, which is used for error messages and diagnostics issued by the program.
In the GNU C library,
normal variables which you can set just like any others. For example,
to redirect the standard output to a file, you could do:
fclose (stdout); stdout = fopen ("standard-output-file", "w");
Note however, that in other systems
stderr are macros that you cannot assign to in the normal way.
But you can use
freopen to get the effect of closing one and
reopening it. See Opening Streams.
The three streams
stderr are not
unoriented at program start (see Streams and I18N).