Bug #13667 Updated: fread doesn't works when the file opened with 'w+'
| From: | sander@php.net | Date: | Fri, 19 Oct 2001 11:40:57 +0000 |
| Subject: | Bug #13667 Updated: fread doesn't works when the file opened with 'w+' | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-68357@lists.php.net to get a copy of this message | ||
ID: 13667
Updated by: sander
Reported By: manu@chasqui.uclv.edu.cu
Old Status: Open
Status: Bogus
Bug Type: Filesystem function related
Operating System: Windows 2000 Advanced Server
PHP Version: 4.0.6
New Comment:
From the docs:
"... place the file pointer at the beginning of the file and truncate the file to zero
length"
I don't think there is much to read from a zero-length file...
Previous Comments:
------------------------------------------------------------------------
[2001-10-14 17:45:41] manu@chasqui.uclv.edu.cu
$fh = fopen('myfile.txt', 'w+');
$content = fread( $h, filesize('myfile.txt'));
echo $content;
fseek( $fh, 0 );
fwrite( $fh, $newcontent );
ftruncate( $fh, strlen( $newcontent ) );
No matters de contents of myfile.txt, no output is generated.
If I replace the first line to
$fh = fopen('myfile.txt', 'r+');
everythings works fine if the file exists.
Manu.
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=13667&edit=1