note 10242 added to fwrite
| From: | khanh_etc at yahoo dot com | Date: | Wed, 20 Dec 2000 15:42:16 +0000 |
| Subject: | note 10242 added to fwrite | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-8957@lists.php.net to get a copy of this message | ||
On Linux (RH6.1), if the hard drive is full, fwrite does not return an error. For example:
$fd = fopen( "/tmp/tmp", "w+" );
$str = "hello world";
$len = strlen( $str );
$size = fwrite( $fd, $str, $len );
//here we have $size == $len
fclose( $fd );
// the file is empty due to no space in the hard drive.
To detect fwrite error, add
set_file_buffer( $fd, 0 ) before fwrite, and fwrite will return an error.
http://www.php.net/manual/function.fwrite.php