.TH FTRUNCATE 3 .SH NAME ftruncate, truncate \- truncate a file .SH SYNOPSIS .ft B .nf #define _MINIX_SOURCE 1 #include int ftruncate(int \fIfd\fP, off_t \fIsize\fP) int truncate(const char *\fIfile\fP, off_t \fIsize\fP) .fi .ft R .SH DESCRIPTION The .B ftruncate() call truncates an open file to the given size. The blocks beyond the old size are returned to the free block space of the file system. The file must be open for writing. .PP .B Truncate() truncates a file by name. The file must allow writing to. .SH "SEE ALSO" .BR fcntl (2). .SH DIAGNOSTICS Both routines return 0 on success and -1 on error with .B errno set appropriately. .SH NOTES .B Ftruncate() is a simple stub that uses the .B F_FREESP command of .BR fcntl (2). .B Truncate() opens the file to obtain a file descriptor and then uses .BR ftruncate() . .SH AUTHOR Kees J. Bot (kjb@cs.vu.nl) \". \". $PchId: ftruncate.3,v 1.3 1995/11/27 20:24:25 philip Exp $