This shows you the differences between two versions of the page.
— |
ftruncate [2006/10/06 19:08] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | # $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 [[echo]]ing. | ||
+ | |||
+ | ======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. | ||
+ | |||