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. This function is not available in read-only configuration or minimization level of >=1.