go to previous page   go to home page   go to next page        


Closing a file asks the system to finish all activity with the file and to make it no longer available for further activity.

Closing a File

Computer terms often come from office paractice of past decades. Computer files were designed to replace the paper files used in offices. Closing a file means gathering up everything that should go into it and filing it away.

Use the close() method when a program is done with a file. If you don't, the program might stop running before the operating system has finished writing data to the file. The data written to the file might be lost!

Or it might not, depending on how busy the operating system is. This is a notorious computer bug! It can be very frustrating, because sometimes a buggy program will work correctly, and sometimes not.


Can a file be written while it is closed?