note 39652 added to function.ftruncate

From: Date: Fri, 06 Feb 2004 09:05:02 +0000
Subject: note 39652 added to function.ftruncate
Groups: php.notes 
Request: Send a blank email to php-notes+get-64712@lists.php.net to get a copy of this message
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); ?> ---- Manual Page -- http://www.php.net/manual/en/function.ftruncate.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+39652 Delete -- http://master.php.net/manage/user-notes.php?action=delete+39652&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+39652&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#64712) next »