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

# termkey\_interpret\_string(3)

fetch stored control string

## NAME

termkey\_interpret\_string - fetch stored control string

## SYNOPSIS

```
#include <termkey.h>

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

Link with *-ltermkey*.

## 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

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

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