File I/O Support for Embedded Systems
2-20
2.6.4
EFS Standard API Functions
Close File
efs_fclose
Syntax
int efs_fclose( EFS_FILE *stream );
Parameter(s)
stream
Pointer to open stream (file)
Return Value
Returns EOF if any errors occurred, and zero otherwise
Description
This function performs a logical “close” on an open file. It is functionally equiva-
lent to fclose().
Test for End of File
efs_feof
Syntax
int efs_feof( EFS_FILE *stream );
Parameter(s)
stream
Pointer to open stream (file)
Return Value
Returns non-zero if EOF has been reached, and zero otherwise
Description
This function tests to see is the file position has reached the end of the file. It
is functionally equivalent to feof().
Open File
efs_fopen
Syntax
EFS_FILE *efs_fopen( char *name, char *mode );
Parameter(s)
name
Name of file to open
mode
Desired mode of open file
Return Value
Returns a stream pointer or NULL on error
Description
This function performs a logical “open” on the named file and returns a stream
or NULL if the attempt fails. It is functionally equivalent to fopen().
The mode parameter determines the mode for with the file is opened. In the
embedded file system version of this function, the list of supported modes is
quite simple:
“rb” – open binary file for reading
The flags are still passed though to ensure compatibility with a full file system.