Up until now, any reading and writing we've done has been from the keyboard and to the terminal screen, unless, of course, we use Unix's ability to redirect the standard input and output, as in :
a.out < input.dat > output.txt
This causes all input to come from the file, input.dat, and all output to go, not to the terminal, but to the file output.txt.
This method works for one input file and one output file, but is not very general. In fact, if you are using redirection for input, the keyboard is disabled and the user cannot interact with the program at all.
We can, however, use C's file-handling capabilities to get input from files as well as from the keyboard and to write to multiple files and the screen all in one program. File-handling in C requires the use of file pointers, of type FILE*.