close - close file
Standard C Library (libc, -lc)
The file handle fd is closed. The same file handle may then be returned again from open, dup2, pipe, or similar calls.
Other file handles are not affected in any way, even if they are attached to the same file.
According to POSIX, even if the underlying operation fails, the file is closed anyway and the file handle becomes invalid.
On success, close returns 0. On error, -1 is returned, and errno is set according to the error encountered.
The following error codes should be returned under the conditions given. Other error codes may be returned for other cases not mentioned here.
|EBADF||fd is not a valid file handle.|
|EIO||A hard I/O error occurred.|