2.12 Closing a file

There is usually no need to close any files. When you open another file, the first one is closed automatically. And when you quit the program all files are closed. It seems like there is no need at all to close files manually, but that is a mistake.

If you want to open a file for reading to which you've just written, you will find it doesn't work. Of course, you can open a file only once. You could force closing by opening another one, but that is a bit sloppy.

No, there is a word which closes either the input- or the output-file, using the same read/write-flags. You've already seen it, it is called 'CLOSE'. When you close a file, the input (or output) is redirected to the keyboard (or screen) again. Our advise: don't use it unless you have to. 4tH knows best.