f_open()

[FreeRTOS Embedded File System API]

header_file.h
F_FILE * f_open( const char *pcFileName, const char *pcMode );
		

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

Parameters:

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:

String
Description
"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.

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