write (stream)

void lacewing::stream::write (const char * buffer, size_t size = -1)
void lacewing::stream::write (stream, size_t size = -1, bool delete_when_finished = false)
void lw_stream_write (lw_stream, const char * buffer, size_t size)
void lw_stream_write_text (lw_stream, const char * buffer)
void lw_stream_writef (lw_stream, const char * format, ...)
void lw_stream_writev (lw_stream, const char * format, va_list)
void lw_stream_write_stream (lw_stream dest, lw_stream src, size_t size, lw_bool delete_when_finished)


Write data or another stream upstream. For convenience, this is also available as the << operator in C++.

This method does not block, but in the case of writing data it always consumes the entire buffer before returning (data may be buffered internally where necessary).

Note that writing data directly from another stream is not necessarily equivalent to reading the data and writing it forward. The library will endeavour to splice in the most efficient way possible (e.g. when writing from one fdstream to another, a kernel function such as sendfile or TransmitFile may be used.)



A pointer to the data to write.

size [optional]

The size of the data in bytes, or -1 if the data is a null-terminated string.

Parameters (alternative)


Another stream to write from.

size [optional]

The number of bytes to write from the source stream, or -1 to write everything the source stream can produce.

delete_when_finished [optional]

true to delete the source stream when the write is complete. In the case of a -1 size, this will be when the destination stream is deleted.

See also

<< Back to lacewing
View function source >>