The f_truncate function truncates the file size.
FRESULT f_truncate ( FIL* FileObject /* Pointer to the file object */ );
The f_truncate function truncates the file size to the current file R/W point. When the file R/W pointer is already pointing end of the file, this function has no effect.
Available when _FS_READONLY == 0 and _FS_MINIMIZE == 0.