Quality RTOS & Embedded Software

Featured FreeRTOS IoT Integrations:
Extended Maintenance Plan (EMP):
Delta Over-the-Air Updates:
December 2021 Releases:
FreeRTOS LTS libraries:


[FreeRTOS Embedded File System API]

unsigned char f_flush( F_FILE *pxFileHandle );

Ensure all the data that has been altered in a FAT file is comitted to the disk.


pxFileHandle   The handle of the file being flushed. The handle is returned by the call to f_open() used to originally open the file.

F_NO_ERROR   All data associated with the file was comitted to the disk.

Any other value   The file could not be flushed. The return value holds the error code.

See also

f_read(), f_write(), f_open(), f_close().

Example usage:

void vSampleFunction( void )
F_FILE *pxFile;
char *pcString = "ABC";

/* Open the file afile.bin for writing. */
pxFile = f_open( "afile.bin","w" );
if( pxFile != NULL )
/* Write three bytes to the opened file. */
f_write( pcString, strlen( pcString ), 1, pxFile );

/* Flush the file to ensure the data is commited before continuing. */
f_flush( pxFile );

* Other file accesses can occur here before the file is evenutally
* closed using a call to f_close().


Example use of the f_flush() API function
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.