xref: /minix3/minix/man/man2/truncate.2 (revision 433d6423c39e34ec4b79c950597bb2d236f886be)
TRUNCATE 2 "Feb 13, 2006"
C 4
NAME
truncate, ftruncate - truncate a file to a specified length (may extend)
SYNOPSIS
#include <unistd.h>

int truncate(char *filename, off_t length);
int ftruncate(int fd, off_t length);
DESCRIPTION
Truncate causes the file filename to be set to the length length causing data after that size to be lost. If the file is set to a length larger than the current file size, the new region can be written to but reads as zeroes. There will be no disk blocks reserved for it. This is a hole.

Ftruncate does the same thing as truncate but operates on a file descriptor instead of a filename.

"SEE ALSO
fcntl (2)