Go to the first, previous, next, last section, table of contents.
#include <unistd.h> int ftruncate(int handle, off_t where);
This function truncates the file open on handle at byte position where. The file pointer associated with handle is not changed.
Note that this function knows nothing about buffering by stdio functions
like fwrite
and fprintf
, so if handle comes from a
FILE
object, you need to call fflush
before calling this
function.
Zero for success, nonzero for failure.
not ANSI, not POSIX
int x = open("data", O_WRONLY); ftruncate(x, 1000); close(x);
Go to the first, previous, next, last section, table of contents.