summaryrefslogtreecommitdiff
path: root/minix/man/man2/truncate.2
blob: 4102e6d828d68fbeba74f450fb4d30c08aaa94dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
.TH TRUNCATE 2 "Feb 13, 2006"
.UC 4
.SH NAME
truncate, ftruncate \- truncate a file to a specified length (may extend)
.SH SYNOPSIS
.ft B
.nf
#include <unistd.h>

int truncate(char *filename, off_t length);
int ftruncate(int fd, off_t length);
.fi
.ft R
.SH DESCRIPTION
.B Truncate
causes the file 
.B filename
to be set to the length
.B 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.
.PP
.B Ftruncate
does the same thing as 
.B truncate
but operates on a file descriptor instead of a filename.
.SH "SEE ALSO
.BR fcntl (2)