1
0
mirror of https://github.com/php/doc-fr.git synced 2026-03-23 22:52:18 +01:00
Files
archived-doc-fr/reference/bzip2/examples.xml
2026-02-20 09:45:20 +01:00

65 lines
1.5 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 5fdeb11b137c94a6d25cbe98a2e14c00366197cf Maintainer: yannick Status: ready -->
<!-- Reviewed: yes -->
<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="bzip2.examples">
&reftitle.examples;
<simpara>
Cet exemple ouvre un fichier temporaire et y écrit une chaîne de test,
puis, affiche le contenu de ce fichier.
</simpara>
<example>
<title>Petit exemple avec bzip2</title>
<programlisting role="php">
<![CDATA[
<?php
$filename = "/tmp/testfile.bz2";
$str = "Ceci est une chaîne de test.\n";
// Ouvre un fichier en écriture
$bz = bzopen($filename, "w");
// Écrit une chaîne
bzwrite($bz, $str);
// Ferme le fichier
bzclose($bz);
// Ouvre le fichier en lecture
$bz = bzopen($filename, "r");
// Lit 10 caractères
echo bzread($bz, 10);
// Affiche jusqu'à la fin du fichier (ou les 1024 prochains caractères) et le ferme
echo bzread($bz);
bzclose($bz);
?>
]]>
</programlisting>
</example>
</chapter>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->