note 39652 deleted from function.ftruncate by nlopess
| From: | nlopess@php.net | Date: | Fri, 06 Feb 2004 14:44:54 +0000 |
| Subject: | note 39652 deleted from function.ftruncate by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-64730@lists.php.net to get a copy of this message | ||
Note Submitter: tom@bitworks.de
----
You can pad an empty file with an accurately defined
number of NULLs using the truncate function. No error
message will occur.
<?php ## ftruncate.php ##
error_reporting(E_ALL);
$filename = "./test.dat"; //non existing file
if ($fh = fopen($filename, "a+"))
{
ftruncate ( $fh, 300);
}
fclose($fh);
?>