|TRUNCATE(2)||System Calls Manual||TRUNCATE(2)|
char *path, off_t
truncate() causes the file named by path or referenced by fd to be truncated or extended to length bytes in size. If the file was larger than this size, the extra data is lost. If the file was smaller than this size, it will be extended as if by writing bytes with the value zero. With
ftruncate(), the file must be open for writing.
ftruncate() will succeed unless:
truncate() may return the
NAME_MAXcharacters, or an entire pathname (including the terminating NUL) exceeded
ftruncate() may return the following
ftruncate() functions conform to IEEE Std 1003.1-2008 (“POSIX.1”).
ftruncate() system calls first appeared in 4.1cBSD.
truncate() to extend a file is not
|February 28, 2016||OpenBSD-current|