The predefined files known as stdin , stdout and stderr normally correspond to the keyboard and, for both stdout and stderr , the display. Most host operating systems provide facilities to reconnect these to files but such reconnection or redirection is totally invisible to the program.
All three are, in fact, objects of type pointer to FILE, and they may be used in any file handling function in just the same way as a pointer returned by fopen(). In fact the macro putchar(c) is really nothing more than
putc(c,stdout)
It is sometimes useful to initialise a pointer to FILE to point to one of the standard items, to provide a "standard input as default" type of operation.
FILE *ifp = stdin; being a typical definition.
stderr is subject to separate host operating system redirection to stdout and is commonly used to write error messages. Typically a programmer would write
fprintf(stderr,"Couldn't open \"%s\"\n",filename);