Skip to content

substdio_out.3

Manvendra Bhangui edited this page Feb 25, 2024 · 4 revisions

NAME

substdio_out - substdio output routines

SYNTAX

#include <substdio.h>

int substdio_put(&s,from,len);
int substdio_puts(&s,from);

int substdio_bput(&s,from,len);
int substdio_bputs(&s,from);

int substdio_flush(&s);

int substdio_putflush(&s,from,len);
int substdio_putsflush(&s,from);

substdio s;
char *from;
int len;

DESCRIPTION

substdio_put writes len characters to s out of the character array from. It returns 0 on success, -1 on error.

substdio_bput has the same function as substdio_put. The difference is how the buffer is flushed when there isn't enough room for len characters:
substdio_put flushes the buffered data before copying the new data, whereas substdio_bput fills the buffer with new data before flushing.

substdio_flush forces all data to be written from the internal buffer. It returns 0 on success, -1 on error.

substdio_putflush is similar to substdio_put followed by substdio_flush, but it avoids all internal copies.

substdio_puts, substdio_bputs, and substdio_putsflush are the same as substdio_put, substdio_bput, and substdio_putflush except that from must be a 0-terminated string of characters. The string, not including the 0, is written.

The SUBSTDIO_OUTSIZE macro is defined as a reasonably large output buffer size for substdio_fdbuf.

INTERNALS

When a substdio variable s is used for output, data is buffered from s.x to s.x + s.p; there is free buffer space from to s.x + s.p to s.x + s.n; the total buffer length is s.n.

SEE ALSO

substdio(3)

Clone this wiki locally