Skip to main content

Raw output

int lt_send(const char *buf, size_t nbuf);
int lt_sendf(const char *fmt, ...);

Both bypass the cell buffer. They exist for escape sequences libterm does not model. After a raw write that changes what is on screen, call lt_invalidate so the next lt_present repaints everything.

lt_send​

int lt_send(const char *buf, size_t nbuf);

Writes nbuf bytes verbatim to the terminal. They are buffered and flushed immediately. The caller owns their correctness and any effect on the rendered screen.

Parameters​

NameTypeMeaning
bufconst char *the bytes to write
nbufsize_thow many of them

Returns​

ValueWhen
LT_OKthe bytes were written
LT_ERR_NOT_INITbefore lt_init
LT_ERRbuf is NULL

Example​

static const char bell[] = "\a";
lt_send(bell, 1); /* ring the terminal bell */

See also​

lt_sendf, lt_invalidate.

lt_sendf​

int lt_sendf(const char *fmt, ...);

A printf-style wrapper over lt_send. The text is formatted into an internal fixed buffer, truncated if it would exceed it, and then sent.

Parameters​

NameTypeMeaning
fmt, ...const char *a printf format and its arguments

Returns​

As lt_send.

Example​

lt_sendf("\x1b]0;%s\x07", "my app"); /* OSC 0: set the window title */
lt_invalidate();

See also​

lt_send, Screen and rendering.