Date: 08/31/00
- Next message: Uwe Steinmann: "[PHP-DOC] cvs: phpdoc /de/functions cpdf.xml"
- Previous message: Luca Perugini: "Re: [PHP-DOC] cvs: phpdoc /it/functions strings.xml"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
danbeck Thu Aug 31 07:16:36 2000 EDT
Modified files:
/phpdoc/en/functions filesystem.xml
Log:
commit for Brian Moon: clarified set_file_buffer documentation, added example
Index: phpdoc/en/functions/filesystem.xml
diff -u phpdoc/en/functions/filesystem.xml:1.37 phpdoc/en/functions/filesystem.xml:1.38
--- phpdoc/en/functions/filesystem.xml:1.37 Sun Aug 27 04:39:39 2000
+++ phpdoc/en/functions/filesystem.xml Thu Aug 31 07:16:36 2000
@@ -1531,22 +1531,39 @@
</funcprototype>
</funcsynopsis>
<simpara>
- <function>set_file_buffer</function> sets the buffering for write
- operations on the given filepointer <parameter>fp</parameter> to
- <parameter>buffer</parameter> bytes. If
- <parameter>buffer</parameter> is 0 then write operations are
- unbuffered.
+ Output using <function>fwrite</function> is normally buffered at
+ 8K. This means that if there are two processess wanting to write
+ to the same output stream (a file), each is paused after 8K of
+ data to allow the other to write. <function>set_file_buffer</function>
+ sets the buffering for write operations on the given filepointer
+ <parameter>fp</parameter> to <parameter>buffer</parameter> bytes.
+ If <parameter>buffer</parameter> is 0 then write operations are
+ unbuffered. This ensures that all writes with
+ <function>fwrite</function> are completed before other processes
+ are allowed to write to that output stream.
</simpara>
<simpara>
The function returns 0 on success, or EOF if the request cannot
be honored.
</simpara>
+ <para>
+ The following example demonstrates how to use
+ <function>set_file_buffer</function> to create an unbuffered stream.
+ <example>
+ <title><function>set_file_buffer</function> example</title>
+ <programlisting role="php">
+$fp=fopen($file, "w");
+if($fp){
+ set_file_buffer($fp, 0);
+ fputs($fp, $output);
+ fclose($fp);
+}
+ </programlisting>
+ </example>
+ </para>
+
<simpara>
- Note that the default for any fopen with calling set_file_buffer
- is 8K.
- </simpara>
- <simpara>
- See also <function>fopen</function>.
+ See also <function>fopen</function>, <function>fwrite</function>.
</simpara>
</refsect1>
</refentry>
- Next message: Uwe Steinmann: "[PHP-DOC] cvs: phpdoc /de/functions cpdf.xml"
- Previous message: Luca Perugini: "Re: [PHP-DOC] cvs: phpdoc /it/functions strings.xml"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

