<< Previous | Next >>

fat_Close

int fat_Close( FATfile *file );

Description

Closes a currently open file. You should check the return code since an I/O needs to be performed when closing a file to update the file's EOF offset (length), last access date, attributes and last write date (if modified) in the directory entry. This is particularly critical when using non-blocking mode.

Parameters

file
Pointer to the open file to close.

Return Value

0: success.
-EINVAL: invalid file handle.
-EBUSY: For non-blocking mode only, the device is busy. Call this function again to complete the close.

Any other negative value means that an I/O error occurred when updating the directory entry. In this case, the file is forced to close, but its recorded length might not be valid.

Library

FAT.LIB

See Also

fat_Open, fat_OpenDir


Dynamic C Functions << Previous | Next >> rabbit.com