The f_truncate function truncates the file size.
FRESULT f_truncate (
FIL* FileObject /* Pointer to the file object */
);
FR_OK, FR_DISK_ERR, FR_INT_ERR, FR_NOT_READY, FR_INVALID_OBJECT, FR_TIMEOUT
The f_truncate function truncates the file size to the current file read/write point. This function has no effect if the file read/write pointer is already pointing end of the file.
Available when _FS_READONLY == 0 and _FS_MINIMIZE == 0.