Download FreeRTOS

Quality RTOS & Embedded Software

New FreeRTOS Long Term Support version released
Simplifying Authenticated Cloud Connectivity for Any Device.
Designing an energy efficient and cloud-connected IoT solution with CoAP.
Introducing FreeRTOS Kernel version 11.0.0:
FreeRTOS Roadmap and Code Contribution process.


[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
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.