svn: /phpdoc/en/trunk/reference/filesystem/functions/ fgets.xml
| From: | Kalle Sommer Nielsen | Date: | Tue, 19 Oct 2010 04:44:44 +0000 |
| Subject: | svn: /phpdoc/en/trunk/reference/filesystem/functions/ fgets.xml | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-7238@lists.php.net to get a copy of this message | ||
kalle Tue, 19 Oct 2010 04:44:44 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=304499
Log:
Improve example for fgets() (Fixes #52721) -- Patch by mmailnew4ster at gmail dot com
Bug: http://bugs.php.net/52721 (Open) fgets() code example
is not 100% correct
Changed paths:
U phpdoc/en/trunk/reference/filesystem/functions/fgets.xml
Modified: phpdoc/en/trunk/reference/filesystem/functions/fgets.xml
===================================================================
--- phpdoc/en/trunk/reference/filesystem/functions/fgets.xml 2010-10-19 04:40:43 UTC (rev 304498)
+++ phpdoc/en/trunk/reference/filesystem/functions/fgets.xml 2010-10-19 04:44:44 UTC (rev 304499)
@@ -102,10 +102,12 @@
<?php
$handle = @fopen("/tmp/inputfile.txt", "r");
if ($handle) {
- while (!feof($handle)) {
- $buffer = fgets($handle, 4096);
+ while (($buffer = fgets($handle, 4096)) !== false) {
echo $buffer;
}
+ if (!feof($handle)) {
+ echo "Error: unexpected fgets() fail\n";
+ }
fclose($handle);
}
?>