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

# termkey\_advisereadable(3)

read more bytes from the underlying terminal

## NAME

termkey\_advisereadable - read more bytes from the underlying terminal

## SYNOPSIS

```
#include <termkey.h>

TermKeyResult termkey_advisereadable(TermKey *tk);
```

Link with *-ltermkey*.

## DESCRIPTION

**termkey\_advisereadable**() informs the [**termkey**(7)](/termkey/7.md) instance that new input may be available on the underlying file descriptor and so it should call [**read**(2)](/read/2.md) to obtain it. If at least one more byte was read it will return **TERMKEY\_RES\_AGAIN** to indicate it may be useful to call [**termkey\_getkey**(3)](/termkey_getkey/3.md) again. If no more input was read then **TERMKEY\_RES\_NONE** is returned. If there was no buffer space remaining, then **TERMKEY\_RES\_ERROR** is returned with *errno* set to **ENOMEM**. If no filehandle is associated with this instance, **TERMKEY\_RES\_ERROR** is returned with *errno* set to **EBADF**.

This function, along with [**termkey\_getkey**(3)](/termkey_getkey/3.md) make it possible to use the termkey instance in an asynchronous program. To provide bytes without using a readable file handle, use [**termkey\_push\_bytes**(3)](/termkey_push_bytes/3.md).

For synchronous usage, [**termkey\_waitkey**(3)](/termkey_waitkey/3.md) performs the input blocking task.

## RETURN VALUE

**termkey\_advisereadable**() returns one of the following constants:

- **TERMKEY\_RES\_AGAIN**

  At least one byte was read.

- **TERMKEY\_RES\_NONE**

  No nore bytes were read.

- **TERMKEY\_RES\_ERROR**

  An IO error occurred. *errno* will be preserved. If the error is **EINTR** then this will only be returned if **TERMKEY\_FLAG\_EINTR** flag is not set; if it is then the IO operation will be retried instead.

## SEE ALSO

[**termkey\_getkey**(3)](/termkey_getkey/3.md), [**termkey\_waitkey**(3)](/termkey_waitkey/3.md), [**termkey\_set\_waittime**(3)](/termkey_set_waittime/3.md), [**termkey**(7)](/termkey/7.md)
