From 82a56f5fa859e61f574e7f35a0cfdc498be6ecb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?= <grubba@grubba.org> Date: Sat, 17 Apr 1999 17:02:15 +0200 Subject: [PATCH] Added documentation for Stdio.sendfile(). Rev: tutorial/tutorial.wmml:1.104 --- tutorial/tutorial.wmml | 44 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/tutorial/tutorial.wmml b/tutorial/tutorial.wmml index 5d7265165a..126dc94e14 100644 --- a/tutorial/tutorial.wmml +++ b/tutorial/tutorial.wmml @@ -4229,6 +4229,50 @@ line editing at his/her disposal when entering the line. </function> +<function name=sendfile title="send contents from one file to another"> +<man_syntax> +object sendfile(array(string) <I>headers</I>,<br> +<dl><dt><dd>object <I>from</I>, int <I>offset</I>, int <I>len</I>,<br> +array(string) <I>trailers</I>,<br> +object <I>to</I>);<br> +</dl><br> +or<br> +object sendfile(array(string) <I>headers</I>,<br> +<dl><dt><dd>object <I>from</I>, int <I>offset</I>, int <I>len</I>,<br> +array(string) <I>trailers</I>,<br> +object <I>to</I>,<br> +function(int, mixed ...:void) <I>callback</I>,<br> +mixed ... <I>args</I>);<br> +</dl> +</man_syntax> +<man_description> +Sends <I>headers</I> followed by <I>len</I> bytes starting at <I>offset</I> +from the file <I>from</I> followed by <I>trailers</I> to the file <I>to</I>. +When completed <I>callback</I> is called with the total number of bytes sent +as the first argument, followed by <I>args</I>. +<p> +Any of <I>headers</I>, <I>from<I> and <I>trailers</I> may be left out +by setting them to 0. +<p> +Setting <I>offset</I> to -1 means send from the current position in +<I>from</I>. +<p> +Setting <I>len</I> to -1 means send until <I>from</I>'s end of file is +reached. +</man_description> +<man_note>The sending is performed asynchronously, and may complete +before the function returns. +<p> +For <I>callback</I> to be called, the backend must be active (ie +<tt>main()</tt> must have returned -1). +<p> +In some cases, the backend must also be active for any sending to +be performed at all. +</man_note> +<man_see>Stdio.File->set_nonblocking</man_see> +</function> + + <function name=werror title="write to stderr"> <man_syntax> void werror(string <I>s</I>);<br> -- GitLab