current_reader/writer/error_stream


current_reader()
current_writer()
current_error_stream()
      

Return the the current input/output/error streams.

These function return streams that are attached to a process's standard input, standard output, and standard error streams.

All input and output operations are performed through objects called streams. A stream is a pointer into a (possibly infinite) stream of data (often a file), an opening through which programs may draw bytes or characters from the stream or place bytes or characters into the stream. A stream may be an input stream, an output stream, or both simultaneously.

There are initially three streams: the current input stream, current output stream, and current error stream, which are textual streams connected to the process's standard input, standard output, and standard error streams. Several ways to open new streams are provided.

If one of the input operations is asked to read from a stream that has reached the end of a finite stream, it returns the eof (end-of-file) object.

Streams are either binary or textual. A binary stream allows a program to read or write 8-bit unsigned bytes, or "octets," from or to the underlying stream. A textual stream allows a program to read or write characters.

A stream may be buffered for efficiency, to eliminate the overhead of a call into the operating system for each byte or character. Three standard buffer modes are supported: block, line, and none. With block buffering, input is drawn from a stream and output is sent to the stream in chunks of some implementation-dependent size. With line buffering, buffering is performed on a line-by-line basis or on some other implementation-dependent basis. Line buffering is typically distinguished from block buffering only for textual output streams; there are no line divisions in binary streams, and input is likely to be drawn from a stream as it becomes available. With buffer-mode none, no buffering is performed, so output is sent immediately to the stream and input is drawn only as needed.

Also see:

transcoder
file_reader
file_writer
byte_array_reader
byte_array_writer
string_reader
string_writer
pipe_reader
pipe_writer
tcp_server_stream
tcp_client_stream
bits_reader
bits_writer
stream_tokenizer


Core Module Index | Contents