Files
doc-fr/reference/bzip2/examples.xml
2021-09-24 04:13:47 +01:00

67 lines
1.4 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 96c9d88bad9a7d7d44bfb7f26c226df7ee9ddf26 Maintainer: yannick Status: ready -->
<!-- Reviewed: yes -->
<chapter xml:id="bzip2.examples" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
&reftitle.examples;
<para>
Cet exemple ouvre un fichier temporaire et y écrit une chaîne de test,
puis, affiche le contenu de ce fichier.
</para>
<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 le contenu du fichier et on 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
-->