PTypes: streams: infile

Top: Streams: infile

>     #include <pstreams.h>

>     class infile: instm {
>         infile( [ const string& filename ] );
>         void pipe(outfile& peer);
>         string get/set_filename(string);
>     }

This class derives all public methods and properties from iobase and instm, and in addition, defines the following:

infile::infile( [ const string& filename ] ) creates an input file stream, but does not open the file. Filename is optional and can be set later, using set_filename().

void infile::pipe(outfile& peer) creates a local pipe. This function sets up and opens the infile and outfile objects so that a thread can asynchronously pass data to another thread within one process. Note that pipe() opens both streams; subsequent calls to open(), close() or cancel() shuts down the pipe. Local pipe is a slower alternative to the message queue. The only advantage of local pipes is that they provide a standard streaming interface.

string infile::get/set_filename(string) sets the file name. set_filename() closes the stream prior to assigning the new value.

See also: iobase, instm, Examples

PTypes home