UNIX FAQ Version 2.1 92/12/04 -- Question 3.3

UNIX FAQ Version 2.1 92/12/04 -- Question 3.3

How do I truncate a file?

The BSD function ftruncate() sets the length of a file. Xenix - and therefore SysV r3.2 and later - has the chsize() system call. For other systems, the only kind of truncation you can do is truncation to length zero with creat() or open(..., O_TRUNC).