f_truncate

The f_truncate function truncates the file size.

FRESULT f_truncate (
  FIL* FileObject     /* Pointer to the file object */
);

Parameter

FileObject
Pointer to the open file object to be truncated.

Return Values

FR_OK (0)
The function succeeded.
FR_DENIED
The file has been opened in read-only mode.
FR_DISK_ERR
The function failed due to an error in the disk function.
FR_INT_ERR
The function failed due to a wrong FAT structure or an internal error.
FR_NOT_READY
The disk drive cannot work due to no medium in the drive or any other reason.
FR_INVALID_OBJECT
The file object is invalid.

Description

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.

References

f_open, f_lseek, FIL

Return