int ftruncate(int fd, int64_t length);
Sets the length of the file referenced by file handle fd to length bytes. Returns zero on success, or the negation of the error code on error.
lseek, truncate