User Tools

Site Tools


ftruncate

# $EPIC: ftruncate.txt,v 1.2 2006/10/06 19:08:28 jnelson Exp $

Synopsis:

$ftruncate(bytes filename)

Technical:

The ftruncate file causes the filename to change to exactly bytes bytes in size. The file is grown or shrunk as necessary. If the file is shrunk, the data beyond the new file size is irretrievably lost. If the file is grown, the contents of the new space is unspecified, but usually it is nuls (ascii 0).

If the operation succeeds, the empty string is returned. If the operation fails, an error string is returned, suitable for echoing.

Practical:

This is useful for clearing a logfile that has gotten too big.

Returns:

The empty string on success, or an error string on failure.

ftruncate.txt · Last modified: 2006/10/06 19:08 (external edit)