## f_truncate

The f_truncate function truncates the file size.

    FRESULT f_truncate (
      FIL* fp     /* [IN] File object */
    );

#### Parameter

fp
  Pointer to the open file object to be truncated. If a null pointer is given, the function fails with `FR_INVALID_OBJECT`.

#### Return Values

FR_OK, FR_DISK_ERR, FR_INT_ERR, FR_DENIED, FR_INVALID_OBJECT, FR_TIMEOUT

#### Description

The `f_truncate` function truncates the file size to the current file read/write pointer. This function has no effect if the file read/write pointer is already pointing end of the file.

#### QuickInfo

Available when `FF_FS_READONLY == 0` and `FF_FS_MINIMIZE == 0`.

#### See Also

`f_open, f_lseek, FIL`

Return