Go to the first, previous, next, last section, table of contents.


ftruncate

Syntax

#include <unistd.h>

int ftruncate(int file, off_t where);

Description

This function truncates file at where length. This only works if the file is closed right after this call.

Return Value

Zero for success, nonzero for failure.

Portability

not ANSI, not POSIX

Example

int x = open("data", O_WRONLY);
ftruncate(x, 1000);
close(x);


Go to the first, previous, next, last section, table of contents.