Method Stdio.Buffer()->output_to()
- Method output_to
int(-1..) output_to(Stdio.Stream|function(string:int) fun, int(0..)|void nbytes)
- Description
Write data from the buffer to the indicated file.
- Parameter fun
Write function. Either one of:
Stdio.Stream A file object in which the function
write()
will be called.function(string:int) A function which will be called with a
string(8bit)
to write and is expected to return anint
indicating the number of bytes successfully written or-1
on failure.
- Parameter nbytes
If nbytes is not specified the whole buffer will be written if possible. Otherwise at most nbytes will be written.
- Returns
Will return the number of bytes that have been written successfully.
If no bytes have been written successfully and
fun()
failed with an error,-1
will be returned.