bfsClose()
PROTOTYPE
#include <bfs.h>
int bfsClose(void);
DESCRIPTION
bfsClose() closes the currently open file. If opened in write mode, any buffered output is written to the file before its metadata is written. After bfsClose() returns, a newly created file is persistent: it will exist with valid contents at the next start up.
If successful, bfsClose() returns 0. Otherwise, it sets errno and returns -1.
ERROR CODES
| EINVAL | No file is open. |
| other | An I/O error occurred while writing buffered data or deleting the previous copy of a file opened in update mode. |
EXAMPLE
/*---------------------------------------------------------------*/
/* Close file and check if successful. */
/*---------------------------------------------------------------*/
if (bfsClose())
perror("error trying to close file!");