• PHP Video Tutorials

PHP - Direct I/O truncate() Function



dio_truncate() function can truncate a file with the fd descriptor by offset bytes.

Syntax

bool dio_truncate(resource fd, int offset)

dio_truncate() function can truncate a file referenced by fd to offset bytes. If an original file is larger than a specified size, excess data is lost. If an original file is smaller than a specified size, then it is not determined whether a file remains the same size or grows. In the latter case, an extended part is read as zero bytes.

dio_truncate() function can return 0 on success, or -1 on failure.

php_function_reference.htm
Advertisements