# FatFs - FIL

## FIL

The FIL structure (file object) holds state of an open file. It is initialzed by f_open function and discarded by f_close function. There is no member that can be changed by the application program.

    typedef struct _FIL_ {
        FATFS*  fs;         /* Pointer to the owner file system object */
        WORD    id;         /* Owner file system mount ID */
        BYTE    flag;       /* File status flags */
        BYTE    csect;      /* Sector address in the cluster */
        DWORD   fptr;       /* File R/W pointer */
        DWORD   fsize;      /* File size */
        DWORD   org_clust;  /* File start cluster */
        DWORD   curr_clust; /* Current cluster */
        DWORD   dsect;      /* Current data sector */
    #if !_FS_READONLY
        DWORD   dir_sect;   /* Sector containing the directory entry */
        BYTE*   dir_ptr;    /* Ponter to the directory entry in the window */
    #endif
    #if !_FS_TINY
        BYTE    buf[_MAX_SS];/* File R/W buffer */
    #endif
    } FIL;

Return