We use closeto terminate the association between a file descriptor, fildes, and its file. The file descriptor becomes available for reuse. It returns 0 if successful and -1 on error.
#include
int close(int fildes);
Note that it can be important to check the return result from close. Some file systems, particularly networked ones, may not report an error writing to a file until the file is closed, as data may not have been confirmed as written when writes are performed.
The number of files that any one running program may have open at once is limited. The limit, defined by the constant OPEN_MAXin limits.h, varies from system to system, but POSIX requires that it be at least 16. This limit may itself be subject to local system-wide limits.(此限制本身可能受到本地系统范围的限制。)