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


[FreeRTOS Embedded File System API]

F_FILE * f_open( const char *pcFileName, const char *pcMode );

Opens a file in the FAT file system ready for reading or writing.


pcFileName   The name of the file being opened. The name is specified as a standard null terminated C string.

pcMode   The mode in which the file will be opened. The following values are valid:

"r" Open the file for reading.
"w" Open the file for writing.
"a" Open the file to append data to the end of the file.
"w+" Open the file for both reading and writing. The file will be truncated to zero length when it is opened.
"a+" Open the file for both appending data to the end of the file and for reading.
"r+" Open the file for both reading and writing.

There is no text mode. All files are treated as being binary.

Null   The file could not be opened.

Any other value   The returned value is the handle to the opened file.

See also

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

Example usage:

void vSampleFunction( void )
F_FILE *pxFile;
char c;

    /* Open a file called afile.bin. */
    pxFile = f_open( "afile.bin", "r" );
    if( pxFile != NULL )
         * Access the file here using f_read().

        /* Close the file when all accesses are complete. */
        f_close( pxFile );
Example use of the f_open() API function

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

Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.