Skip to main content

3.3) Input And Output With Files


To make our programs even more versatile then we need for them to link with files, both to read input values from files and as files to write out our outputs to.
An example of the sort of line of code used to link to files is given below:

open(unit=22, file=’inputdata.dat’)

In a program, this will create a link between the program and the file called inputdata.dat so that data can be read from or to this file (depending on if you are using it as an input or output file).