---
name: "termkey_push_bytes"
section: "3"
platform: "linux"
package: "libtermkey-dev"
version: "0.22-2+b1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/termkey_push_bytes"
---

# termkey\_push\_bytes(3)

supply more bytes to the input buffer

## NAME

termkey\_push\_bytes - supply more bytes to the input buffer

## SYNOPSIS

```
#include <termkey.h>

size_t termkey_push_bytes(TermKey *tk, const char *bytes, size_t len);
```

Link with *-ltermkey*.

## DESCRIPTION

**termkey\_push\_bytes**() allows more bytes of input to be supplied directly into the input buffer of the [**termkey**(7)](/termkey/7.md) instance. If there was no buffer space remaining then -1 is returned with *errno* set to **ENOMEM**.

This function, along with [**termkey\_getkey**(3)](/termkey_getkey/3.md), makes it possible to use the **termkey** instance with a source of bytes other than from reading a filehandle.

For synchronous usage, [**termkey\_waitkey**(3)](/termkey_waitkey/3.md) performs the input blocking task. For use against a regular stream filehandle that supports [**read**(2)](/read/2.md), see [**termkey\_advisereadable**(3)](/termkey_advisereadable/3.md).

## RETURN VALUE

**termkey\_push\_bytes**() the number of bytes consumed from the input (which may be smaller than the length provided, if the buffer runs out of space) or -1 cast to **size\_t** if an error occurs, in which case *errno* is set accordingly.

## SEE ALSO

[**termkey\_getkey**(3)](/termkey_getkey/3.md), [**termkey\_advisereadable**(3)](/termkey_advisereadable/3.md), [**termkey**(7)](/termkey/7.md)
