Real time embedded FreeRTOS RSS feed 
Homepage FreeRTOS+ Products FreeRTOS Labs Integration Services Contact / Enquiries

f_flush()

[FreeRTOS Embedded File System API]

header_file.h
unsigned char f_flush( F_FILE *pxFileHandle );
		

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

Parameters:

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

Returns:
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


[ Back to the top ]    [ About FreeRTOS ]    [ FreeRTOS+ Sitemap ]    [ Main FreeRTOS Sitemap ]    [ ]


Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.