|
CX Framework
Cross-platform C utility framework
|
Functions | |
| bool | sbufStrOut (StreamBuffer *sb, string *strout) |
| bool | sbufStrCRegisterPush (StreamBuffer *sb, string *strout) |
Functions for using strings as stream buffer data sinks.
| bool sbufStrCRegisterPush | ( | StreamBuffer * | sb, |
| string * | strout | ||
| ) |
bool sbufStrCRegisterPush(StreamBuffer *sb, string *strout)
Registers a string as a consumer with the stream buffer in push mode.
In push mode, data is automatically appended to the string as it becomes available from the producer. Use this instead of sbufStrOut() when you need the producer and consumer to operate asynchronously.
Note: This function appends to the string rather than overwriting it.
| sb | The stream buffer |
| strout | String to append output data to |
| bool sbufStrOut | ( | StreamBuffer * | sb, |
| string * | strout | ||
| ) |
bool sbufStrOut(StreamBuffer *sb, string *strout)
Consumes all available data from the buffer and outputs to a string.
Reads data from the stream buffer until the producer finishes (EOF) and writes it to the output string, overwriting any existing contents.
IMPORTANT: The stream buffer is invalidated after this call.
| sb | The stream buffer (invalidated after call) |
| strout | Output string (will be overwritten) |
Example: