Rev | Line | |
---|
[9] | 1 | .TH TRUNCATE 2 "Feb 13, 2006"
|
---|
| 2 | .UC 4
|
---|
| 3 | .SH NAME
|
---|
| 4 | truncate, ftruncate \- truncate a file to a specified length (may extend)
|
---|
| 5 | .SH SYNOPSIS
|
---|
| 6 | .ft B
|
---|
| 7 | .nf
|
---|
| 8 | #include <unistd.h>
|
---|
| 9 |
|
---|
| 10 | int truncate(char *filename, off_t length);
|
---|
| 11 | int ftruncate(int fd, off_t length);
|
---|
| 12 | .fi
|
---|
| 13 | .ft R
|
---|
| 14 | .SH DESCRIPTION
|
---|
| 15 | .B Truncate
|
---|
| 16 | causes the file
|
---|
| 17 | .B filename
|
---|
| 18 | to be set to the length
|
---|
| 19 | .B length
|
---|
| 20 | causing data after that size to be lost. If the file is set to a
|
---|
| 21 | length larger than the current file size, the new region can be
|
---|
| 22 | written to but reads as zeroes. There will be no disk blocks reserved
|
---|
| 23 | for it. This is a hole.
|
---|
| 24 | .PP
|
---|
| 25 | .B Ftruncate
|
---|
| 26 | does the same thing as
|
---|
| 27 | .B truncate
|
---|
| 28 | but operates on a file descriptor instead of a filename.
|
---|
| 29 | .SH "SEE ALSO
|
---|
| 30 | .BR fcntl (2)
|
---|
Note:
See
TracBrowser
for help on using the repository browser.