Go to the previous, next section.

ftruncate and truncate

SYNOPSIS

int ftruncate(int fd, size_t length);

int truncate(char *path, size_t length);

DESCRIPTION

Those calls truncate a file to a specified length. In the case of ftruncate, the file must be opened for writing.

PARAMETERS

fd: [in] the file descriptor to truncate.

path: [in] points to the path of the file to truncate.

length: [in] the new size of the file.

RETURN VALUE

On success zero is returned. On error, -1 is returned and errno is set to one of the following values:

for ftruncate:

for truncate:

Go to the previous, next section.