Next: , Previous: Creating a BPipe object, Up: Accessing the data stream


4.2 Attaching to input and output streams

If the application is acting as a sink or filter for data, it must attach a BPipe to an input data stream. If the program serves only as a source of data, it doesn't require an input stream. bpipe_input attaches a data stream to a BPipe's input channel and reads and parses the data stream's header packet. A BPipe cannot be attached to more than one input source.

If the program is a source or a filter of data, it must attach at least one output stream to the BPipe. The bpipe_output function creates an output channel and attaches a data stream to it. It returns a handle to the output channel that is used to identify the channel to other utility routines. More than one output stream may be connected to a single BPipe. If the input stream will be split into multiple output streams, it's far easier to attach multiple output streams than to create multiple BPipes, as it is possible to specify on a per output stream basis the data fields that are to be written.

At present input and output streams must be either files or the UNIX standard input or standard output streams. See bpipe_input and bpipe_output.