Real time embedded FreeRTOS RSS feed 
Homepage FreeRTOS+ Products FreeRTOS Labs Support Forum Contact / Enquiries

f_rewind()

[FreeRTOS Embedded File System API]

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

Sets the current read/write position of an open FAT file back to the start of the file.

Parameters:

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

Returns:
F_NO_ERROR   The file was reset.

Any other value   An error occurred. The returned value holds the error code.

See also

f_seek(), f_tell().

Example usage:


void vSampleFunction( void )
{
char pcBuffer1[ 4 ], pcBuffer2[ 4 ];
F_FILE *pxFile;

    /* Open the file "afile.bin". */
    pxFile = f_open( "afile.bin", "r" );

    if( pxFile != NULL )
    {
        /* Read four bytes into pcBuffer1. */
        f_read( pcBuffer1, 4, 1, pxFile );

        /* Set the current read pointer back to the start of the file. */
        f_rewind( pxFile );

        /* Read the same four bytes into pcBuffer2. */
        f_read( pcBuffer2, 4, 1, pxFile );

        /* Finished with the file. */
        f_close( pxFile );
    }
}
						
Example use of the f_rewind() API function


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


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