f_close


Use this function to close a previously opened file.

Format

int f_close ( F_FILE * filehandle )

Arguments

Argument Description Type
filehandle The file handle. F_FILE *

Return values

Return value Description
F_NOERR Successful execution.
Else See Error Codes.

Example

void myfunc()
{
    F_FILE *file;
    char *string = "ABC";
    file = f_open( "myfile.bin", "w" );
    if (!file)
    {
        printf( "File cannot be opened!" );
        return;
    }
    f_write( string, 3, 1, file );   /* Write 3 bytes */
    if (!f_close( file ))
    {
        printf( "File stored" );
    }
    else
    {
        printf( "File close error!" );
    }
}