|
CX Framework
Cross-platform C utility framework
|
Functions | |
| bool | sbufConOut (StreamBuffer *sb, ConStream *con) |
| bool | sbufConCRegisterPush (StreamBuffer *sb, ConStream *con) |
Adapter for using a console stream (see Console) as a stream buffer consumer.
Unlike sbfile.h's VFS adapters, there is no producer half and no close parameter – conOut()/conErr()/conIn() are process singletons and a conCreateMem() stream is owned by whoever created it, so a stream buffer consumer never closes or destroys the ConStream it writes to.
Consumer (Output) Functions:
| bool sbufConCRegisterPush | ( | StreamBuffer * | sb, |
| ConStream * | con | ||
| ) |
bool sbufConCRegisterPush(StreamBuffer *sb, ConStream *con)
Registers a console stream as a consumer with the stream buffer in push mode.
In push mode, data is automatically written to con as it becomes available from the producer. Use this instead of sbufConOut() when you need the producer and consumer to operate asynchronously. Never closes or destroys con.
| sb | The stream buffer |
| con | Console stream to write to |
| bool sbufConOut | ( | StreamBuffer * | sb, |
| ConStream * | con | ||
| ) |
bool sbufConOut(StreamBuffer *sb, ConStream *con)
Consumes all available data from the buffer and writes it to a console stream.
Reads data from the stream buffer until the producer finishes (EOF) and writes it to con in chunks. Never closes or destroys con.
| sb | The stream buffer |
| con | Console stream to write to |
Example: