Closes a file or stream.
#include <unistd.h> int close ( int fildes);
(IN) Specifies the file descriptor for the file to close.
If successful, returns 0. Otherwise, returns -1 and sets errno to one of the following values:
The fildes parameter is returned by a successful execution of the open or creat function. After a file is closed, the file descriptor is no longer valid and should not be reused. The close function deallocates the file descriptor and makes it available for return by functions that allocate file descriptors.
When all file descriptors associated with a pipe or FIFO special file are closed, any data remaining in the pipe or FIFO shall be discarded.