php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #686 file functions not working
Submitted: 1998-08-23 01:31 UTC Modified: 1998-08-23 01:38 UTC
From: z-kimmel at uiuc dot edu Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 3.0.3 OS: NT 4
Private report: No CVE-ID: None
 [1998-08-23 01:31 UTC] z-kimmel at uiuc dot edu
I want to append text to the end of a file, but I can't seem to do it.

The following code doesn't work; the file is unchanged.
--------------------------------------
$fp = fopen($filename, "rw");
$pos=fseek($fp,5);
print($pos);  # prints out 0, which is correct
$pos=ftell($fp);
print($pos);  # prints out 5, which is correct

$error = fwrite($fp, "hello"); # does nothing
$error = fclose($fp);
--------------------------------------
The following code overwrites the file completely.
--------------------------------------
$fp = fopen($filename, "w");
$error = fclose($fp);
--------------------------------------

Anyone know of a workaround?

Thanks,

--Zeba Kimmel, z-kimmel@uiuc.edu

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1998-08-23 01:38 UTC] rasmus
http://ca.php.net/manual/function.fopen.php3
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 11 16:01:32 2024 UTC