Contents

truncate(atOffset:)

Truncates or extends the file represented by the file handle to a specified offset within the file and puts the file pointer at that position.

Declaration

func truncate(atOffset offset: UInt64) throws

Parameters

  • offset:

    The offset within the file that marks the new end of the file.

Discussion

If the file is extended (if offset is beyond the current end of file), the added characters are null bytes.

See Also

Operating on a File