top of page

File I/O, or file input/output, is a topic that allows a program to do 2 things:

​

  1. Read information from an external file (input)

  2. Write information to an external file (output)
     

Can you think of any examples where you’ve encountered programs reading/writing information directly to and from other files? One easy example would be any game you’ve ever played where there was a high score list that remained intact even after exiting and reentering the game. The high score data can’t possibly be encoded in the game itself since the game code is already written but rather all the scores are established after a successful run through the game. This game data is then written as output to a separate file on the hard drive. When the program is closed, that game data is then permanently stored in that separate file. When the game is reopened, the program can then read the information out of that file to populate a high scores list.

​

Here are a few topics to get started with file i/o:

​

Exception Handling

File Input

File Output

​

Exercises

File I/O

bottom of page