1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
function bzip2 ($in, $out){
$txt ='';
if (!file_exists ($in) || !is_readable ($in))
$txt .= 'erreurIn';
if ((!file_exists ($out) && !is_writeable (dirname ($out)) || (file_exists($out) && !is_writable($out)) ))
$txt .= 'erreurOut';
$in_file = fopen ($in, "rb");
if (!$in_file) $txt .= 'Erreurin_file';
$out_file = bzopen ($out, "wb");
if (!$out_file) $txt .= 'Erreur out_file';
while (!feof ($in_file)) {
$buffer = fgets($in_file, 4096);
if (!$buffer) $txt .= 'erreurbuffer : ';
bzwrite ($out_file, $buffer, 4096);
if (!bzwrite) $txt .= 'erreur';
}
fclose ($in_file);
bzclose ($out_file);
return $txt;
} |
Partager