note 13398 added to function.rewind.php
| From: | webmaster at thknuth dot net | Date: | Thu, 14 Jun 2001 17:02:05 +0000 |
| Subject: | note 13398 added to function.rewind.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-14402@lists.php.net to get a copy of this message | ||
Quick and dirty way to overcome the rewind/append problem:
$fp = @fopen( $filename, 'r+' );
if( ! $fp ) $fp = fopen( $filename, 'w+' );
fseek( $fp, 0, SEEK_END );
Will open for read/write and FAIL if file does not exist. Will open for read/write/create in this
case. Filepointer is set to EOF to emulate the append mode.
http://www.php.net/manual/en/function.rewind.php