[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 82

`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 filehandle.
FileCreate |  | Create a new file and return a handle to it.
FileOpen |  | Open an existing file and return a filehandle
FileRead |  | Read data from a filehandle in a buffer.
FileSeek |  | Set the current file position on a file handle.

The latest version of this document can be found at lazarus-ccr.sourceforge.net.