Bug #13667: fread doesn't works when the file opened with 'w+'
| From: | manu at chasqui dot uclv dot edu dot cu | Date: | Sun, 14 Oct 2001 21:45:41 +0000 |
| Subject: | Bug #13667: fread doesn't works when the file opened with 'w+' | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-67933@lists.php.net to get a copy of this message | ||
From: manu@chasqui.uclv.edu.cu
Operating system: Windows 2000 Advanced Server
PHP version: 4.0.6
PHP Bug Type: Filesystem function related
Bug description: fread doesn't works when the file opened with 'w+'
$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 bug report at: http://bugs.php.net/?id=13667&edit=1