note 10242 deleted from function.fwrite by jimw
| From: | jimw@php.net | Date: | Fri, 19 Oct 2001 18:05:59 +0000 |
| Subject: | note 10242 deleted from function.fwrite by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-19167@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.