Next: , Up: Concrete styled_ostream subclasses   [Contents][Index]


3.5.4.1 The term_styled_ostream class

The term_styled_ostream class supports styled output to a file descriptor that is connected to a terminal emulator or console. Its type is ‘term_styled_ostream_t’. It is a subclass of ‘styled_ostream_t’.

It can be instantiated through this function:

Function: term_styled_ostream_t term_styled_ostream_create (int fd, const char *filename, ttyctl_t tty_control, const char *css_filename)

Creates an output stream referring to the file descriptor fd, styled with the file css_filename.

filename is used only for error messages.

tty_control specifies the amount of control to take over the underlying tty.

Note: The resulting stream must be closed before fd can be closed.

Returns NULL upon failure.

The following is a variant of this function. Upon failure, it does not return NULL; instead, it returns a styled fd_stream on which the styling operations exist but are no-ops.

Function: styled_ostream_t styled_ostream_create (int fd, const char *filename, ttyctl_t tty_control, const char *css_filename)

Creates an output stream referring to the file descriptor fd, styled with the file css_filename if possible.

filename is used only for error messages.

tty_control specifies the amount of control to take over the underlying tty.

Note: The resulting stream must be closed before fd can be closed.