Direct IO
PHP Manual


(PHP 4 >= 4.2.0, PHP 5 <= 5.0.5)

dio_truncate — Truncates file descriptor fd to offset bytes


bool dio_truncate ( resource $fd , int $offset )

dio_truncate() truncates a file to at most offset bytes in size.

If the file previously was larger than this size, the extra data is lost. If the file previously was shorter, it is unspecified whether the file is left unchanged or is extended. In the latter case the extended part reads as zero bytes.

Note: This function is not implemented on Windows platforms.



The file descriptor returned by dio_open().


The offset in bytes.

Return Values

Returns TRUE on success or FALSE on failure.

Direct IO
PHP Manual