O'Reilly logo
  • Ivan Petrov thinks this is interesting:

Setting File Length

Two system calls make it possible to adjust the size of a file:

#include <unistd.h>
#include <sys/types.h>

int truncate(const char *path, off_t length);                  XSI
int ftruncate(int fd, off_t length);                 

From

Cover of Linux® Programming by Example

Note

changing file size