Bug #15553 Updated: fopen() when using r+ overwrites whateva is at top
| From: | torben@php.net | Date: | Thu, 14 Feb 2002 19:15:56 +0000 |
| Subject: | Bug #15553 Updated: fopen() when using r+ overwrites whateva is at top | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-326@lists.php.net to get a copy of this message | ||
ID: 15553
Updated by: torben@php.net
Reported By: smythe@smythey.org
-Status: Open
+Status: Bogus
Bug Type: Filesystem function related
Operating System: Win2K
PHP Version: 4.1.1
New Comment:
That's 'cause that what 'r+' does:
http://www.php.net/fopen
The underlying system call does not support prepending to
files--this is a pretty common request, in fact. For
solutions, please ask on the php-general@lists.php.net
support list or check out http://www.php.net/support.php
for help.
Torben
Previous Comments:
------------------------------------------------------------------------
[2002-02-14 09:35:05] smythe@smythey.org
<?
$output = "\nGday.\n";
$directory = dirname($path_translated);
$filename = fopen($directory . "members/addop.txt", "r+", 1) or
die("Can't open file");
if ($output) {
$written = fwrite($filename, $output) or die ("Couldn't write to
file");
}
fclose($filename);
?>
When usin r+ it writes to the file addop.txt but just overwrites
whateva is at the top. i want it to just add to the top of the file.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=15553&edit=1