|Linux / Unix Command: close|
NAMEclose - close a file descriptor
#include <unistd.h> int close(int fd);
DESCRIPTIONclose closes a file descriptor, so that it no longer refers to any file and may be reused. Any locks held on the file it was associated with, and owned by the process, are removed (regardless of the file descriptor that was used to obtain the lock).
If fd is the last copy of a particular file descriptor the resources associated with it are freed; if the descriptor was the last reference to a file which has been removed using unlink(2) the file is deleted.
RETURN VALUEclose returns zero on success, or -1 if an error occurred.
- fd isn't a valid open file descriptor.
- The close() call was interrupted by a signal.
- An I/O error occurred.
CONFORMING TOSVr4, SVID, POSIX, X/OPEN, BSD 4.3. SVr4 documents an additional ENOLINK error condition.
SEE ALSOopen(2), fcntl(2), shutdown(2), unlink(2), fclose(3), fsync(2)
Important: Use the man command (% man) to see how a command is used on your particular computer.