[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'sysutils' (#rtl)

# FileTruncate

Truncate an open file to a given size.

## Declaration

Source position: filutilh.inc line 225

`function FileTruncate(`
`Handle: THandle;`
`Size: Int64`
`):Boolean;`

## Description

FileTruncate truncates the file with handle Handle to Size bytes. The file must have been opened for writing prior to this call. The function returns True is successful, False otherwise.

For an example, see FileCreate.

## Errors

On error, the function returns False.

## See also

FileClose |  | Close a file handle.
FileWrite |  | Write data from a buffer to a given file handle.
FileCreate |  | Create a new file and return a handle to it.
FileOpen |  | Open an existing file and return a file handle
FileRead |  | Read data from a file handle in a buffer.
FileSeek |  | Set the current file position on a file handle.