## f_read

The f_read function reads data from a file.

    FRESULT f_read (
      FIL* fp,     /* [IN] File object */
      void* buff,  /* [OUT] Buffer to store read data */
      UINT btr,    /* [IN] Number of bytes to read */
      UINT* br     /* [OUT] Number of bytes read */
    );

#### Parameters

fp
  Pointer to the open file object structure. If a null pointer is given, the function fails with `FR_INVALID_OBJECT`.
buff
  Pointer to the buffer to store the read data.
btr
  Number of bytes to read in range of `UINT` type. If the file needs to be read fast, it should be read in large chunk as possible.
br
  Pointer to the variable in `UINT` type that receives number of bytes read. This value is always valid after the function call regardless of the function return code. If the return value is equal to `btr`, the function return code should be `FR_OK`.

#### Return Values

FR_OK, FR_DISK_ERR, FR_INT_ERR, FR_DENIED, FR_INVALID_OBJECT, FR_TIMEOUT

#### Description

The function starts to read data from the file at the file offset pointed by read/write pointer of the file object. The read/write pointer advances as number of bytes read. After the function succeeded, `*br` should be checked to detect end of the file. In case of `*br` < `btr`, it means the read/write pointer hit end of the file during read operation.

#### QuickInfo

Always available.

#### Example

Refer to the example in `f_open`.

#### See Also

`f_open, fgets, f_write, f_close, FIL`

Return