note 56637 deleted from function.fopen by danbrown

From: Date: Mon, 08 Jun 2009 23:40:26 +0000
Subject: note 56637 deleted from function.fopen by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-156562@lists.php.net to get a copy of this message
Note Submitter: francis dot fish at gmail dot com ---- None of the examples on the page test to see if the file has been opened successfully. Fopen will return false if it failed. To quickly extend one of the examples in the manual: $filename = "some.dat" ; $dataFile = fopen( $filename, "r" ) ; if ( $dataFile ) { while (!feof($dataFile)) { $buffer = fgets($dataFile, 4096); echo $buffer; } fclose($dataFile); } else { die( "fopen failed for $filename" ) ; } Hope this is some use.

« previous php.notes (#156562) next »