1
0
mirror of https://github.com/php/doc-ja.git synced 2026-03-27 00:22:08 +01:00
Files
archived-doc-ja/reference/bzip2/examples.xml
2010-03-29 00:47:47 +00:00

68 lines
1.6 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 96c9d88bad9a7d7d44bfb7f26c226df7ee9ddf26 Maintainer: takagi Status: ready -->
<!-- CREDITS: hirokawa -->
<chapter xml:id="bzip2.examples" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
&reftitle.examples;
<para>
この例は、テンポラリファイルをオープンし、テスト用の文字列を書き込みます。
この後、このファイルの内容を出力します。
</para>
<example>
<title>簡単な bzip2 の例</title>
<programlisting role="php">
<![CDATA[
<?php
$filename = "/tmp/testfile.bz2";
$str = "This is a test string.\n";
// 書き込み用にオープン
$bz = bzopen($filename, "w");
// ファイルに文字列を書き込む
bzwrite($bz, $str);
// ファイルを閉じる
bzclose($bz);
// 読み込み用にファイルをオープン
$bz = bzopen($filename, "r");
// 10文字読み込む
echo bzread($bz, 10);
// ファイルの終端まで出力(または次の1024文字)し、閉じる
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
-->