TERMKEY\_INTERPRET\_STRING(3) Library Functions Manual TERMKEY\_INTERPRET\_STRING(3)

# [NAME](#NAME)

termkey\_interpret\_string - fetch stored control string

# [SYNOPSIS](#SYNOPSIS)

```
#include <termkey.h>

TermKeyResult termkey_interpret_string(TermKey *tk, const TermKeyKey *key, 
    const char **strp);
```

Link with *-ltermkey*.

# [DESCRIPTION](#DESCRIPTION)

**termkey\_interpret\_string**() fetches the string stored in the **TermKey** instance from the most recently received **TERMKEY\_TYPE\_DCS** or **TERMKEY\_TYPE\_OSC** event. Note that it is important to call this function as soon as possible after obtaining a one of these string key event; specifically, before calling **termkey\_getkey**() or **termkey\_waitkey**() again, as a subsequent call will overwrite the buffer space currently containing this string.

The string pointer whose address is given by *strp* will be set to point at the actual stored string in the instance. The caller is free to read this string (which will be correctly NUL-terminated), but should not modify it. It is not necessary to **free**() the pointer; the containing **TermKey** instance will do that.

# [RETURN VALUE](#RETURN_VALUE)

If passed the most recent *key* event of the type **TERMKEY\_TYPE\_DCS** or **TERMKEY\_TYPE\_OSC**, this function will return **TERMKEY\_RES\_KEY** and will affect the variables whose pointers were passed in, as described above.

For other event types, or stale events, it will return **TERMKEY\_RES\_NONE**, and its effects on any variables whose pointers were passed in are undefined.

# [SEE ALSO](#SEE_ALSO)

[**termkey\_waitkey**(3)](/man/os/libtermkey/termkey_waitkey.3), [**termkey\_getkey**(3)](/man/os/libtermkey/termkey_getkey.3), [**termkey**(7)](/man/os/libtermkey/termkey.7)

---

Document: termkey_interpret_string(3) from libtermkey 0.22-r8 (Chainguard OS)
