This chapter is from the book
3.5 close Function
An open file is closed by
#include <unistd.h> int close(int filedes); Returns: 0 if OK, –1 on error
Closing a file also releases any record locks that the process may have on the file. We'll discuss this in Section 12.3.
When a process terminates, all open files are automatically closed by the kernel. Many programs take advantage of this fact and don't explicitly close open files. See Program 1.2, for example.