cvs: phpdoc /en/reference/filesystem/functions fwrite.xml

From: Date: Thu, 28 May 2009 09:00:55 +0000
Subject: cvs: phpdoc /en/reference/filesystem/functions fwrite.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-4076@lists.php.net to get a copy of this message
vrana Thu May 28 09:00:55 2009 UTC Modified files: /phpdoc/en/reference/filesystem/functions fwrite.xml Log: Network stream http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/filesystem/functions/fwrite.xml?r1=1.18&r2=1.19&diff_format=u Index: phpdoc/en/reference/filesystem/functions/fwrite.xml diff -u phpdoc/en/reference/filesystem/functions/fwrite.xml:1.18 phpdoc/en/reference/filesystem/functions/fwrite.xml:1.19 --- phpdoc/en/reference/filesystem/functions/fwrite.xml:1.18 Fri Apr 18 06:29:10 2008 +++ phpdoc/en/reference/filesystem/functions/fwrite.xml Thu May 28 09:00:55 2009 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.18 $ --> +<!-- $Revision: 1.19 $ --> <refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.fwrite"> <refnamediv> <refname>fwrite</refname> @@ -73,6 +73,28 @@ &reftitle.notes; <note> <para> + Writing to a network stream may end before the whole string is written. + Return value of <function>fwrite</function> may be checked: + <programlisting role="php"> +<![CDATA[ +<?php +function fwrite_stream($fp, $string) { + for ($written = 0; $written < strlen($string); $written += $fwrite) { + $fwrite = fwrite($fp, substr($string, $written)); + if (!$fwrite) { + return $fwrite; + } + } + return $written; +} +?> +]]> + </programlisting> + </para> + </note> + + <note> + <para> On systems which differentiate between binary and text files (i.e. Windows) the file must be opened with 'b' included in <function>fopen</function> mode parameter. @@ -92,9 +114,7 @@ <note> <para> If writing twice to the file pointer, then the data will be appended to - the end of the file content, meaning that the example below wouldn't work - as expected: - + the end of the file content: <programlisting role="php"> <![CDATA[ <?php

« previous php.doc.cvs (#4076) next »