Manuals
General operations
Block device operations
File system operations
File operations
Directory operations
ECF_Flush
ECF_Flush writes all unsaved data in the sector cache to the block device.
ECF_ErrorCode ECF_Flush(
char cDriveLetter
);
char cDriveLetter
);
Parameters
cDriveLetter
This is the drive letter you want to use to refer to this file system. E.g. 'A'.
Return value
Returns one of the ECF error codes (ECFERR_SUCCESS on success)
Remarks
Some systems that can experience sudden power loss can benefit from calling ECF_Flush when it wants to make sure that all data has been written to the block device.
After a successful call to ECF_Flush the data is guaranteed to be written to the block device.
Example Code
#include <ECF/ECF.h>
void WriteToLogFile(struct ECF_FileHandle *fileHandle, const char *szLogEntry)
{
// Error checking omitted
ECF_WriteFile(&fileHandle, strlen(szLogEntry), szLogEntry);
// Make sure the log entry is actually written to disk.
// We assume that the file is located on drive 'A'.
ECF_Flush('A');
}
void WriteToLogFile(struct ECF_FileHandle *fileHandle, const char *szLogEntry)
{
// Error checking omitted
ECF_WriteFile(&fileHandle, strlen(szLogEntry), szLogEntry);
// Make sure the log entry is actually written to disk.
// We assume that the file is located on drive 'A'.
ECF_Flush('A');
}
See also