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, there is no effect. This function is not supported in read-only configuration and minimization level of >=1.