Reading From a File

Now take a look at io4.c. This program reads from a file and writes to the standard output--just the reverse of the previous program. (In fact, it reads from the very file that was written by the previous program, since that file is guaranteed to contain three numbers.)

In this program, our file pointer variable is called infile. What is different about the way that we initialize infile?

Click here for the answer

Try running the program and see what is output. How can you change what is output without changing the program?

Click here for the answer


Joseph L. Zachary
Hamlet Project
Department of Computer Science
University of Utah