ftruncate(3)


NAME
     ftruncate, truncate - truncate a file

SYNOPSIS
     #define _MINIX_SOURCE 1
     #include <unistd.h>

     int ftruncate(int fd, off_t size)
     int truncate(const char *file, off_t size)

DESCRIPTION
     The 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.

     Truncate() truncates a file by name.  The file must allow writing to.

SEE ALSO
     fcntl(2).

DIAGNOSTICS
     Both routines return 0  on  success  and  -1  on  error  with  errno  set
     appropriately.

NOTES
     Ftruncate() is a simple stub that uses the F_FREESP command of  fcntl(2).
     Truncate()  opens  the  file  to  obtain  a file descriptor and then uses
     ftruncate().

AUTHOR
     Kees J. Bot (kjb@cs.vu.nl)