Close (system Call)

For most file systems, a program terminates access to a file in a filesystem using the close system call. This flushes buffers, updates file metadata (which may include and end of file indicator in the data), de-allocates resources associated with the file (including the file descriptor) and updates the system wide table of files in use. Some languages maintain a structure of files opened by its run-time library and may close when the program terminates. Some operating systems will invoke the close if the program terminates. Some operating systems will invoke the close as part of an operating system recovery as a result of a system failure.

C library POSIX definition

The close call is standardized by the POSIX specification

 int close (int filedes);
 int fclose(FILE *stream);

The function returns zero to indicate the file was closed successfully. If any error occurs, a value of -1 is returned and errno is appropriately set.

The errors that can occur include:

The argument supplied was not a valid file descriptor
The function call was interrupted by a signal
An I/O error occurred


External links

  This article uses material from the Wikipedia page available here. It is released under the Creative Commons Attribution-Share-Alike License 3.0.



Connect with defaultLogic
What We've Done
Led Digital Marketing Efforts of Top 500 e-Retailers.
Worked with Top Brands at Leading Agencies.
Successfully Managed Over $50 million in Digital Ad Spend.
Developed Strategies and Processes that Enabled Brands to Grow During an Economic Downturn.
Taught Advanced Internet Marketing Strategies at the graduate level.

Manage research, learning and skills at NCR Works. Create an account using LinkedIn to manage and organize your omni-channel knowledge. NCR Works is like a shopping cart for information -- helping you to save, discuss and share.

  Contact Us