Skip to main content

File Handling

Objectives

So far we have entered information into our programs via the computer's keyboard. This is somewhat laborious if we have a lot of data to process. The solution is to combine all the input data into a file and let our C program read the information when it is required.

Having read this section you should be able to:

  1. open a file for reading or writing
  2. read/write the contents of a file
  3. close the file