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

# termkey\_get\_fd(3)

obtain the file descriptor for the terminal

## NAME

termkey\_get\_fd - obtain the file descriptor for the terminal

## SYNOPSIS

```
#include <termkey.h>

int termkey_get_fd(TermKey *tk);
```

Link with *-ltermkey*.

## DESCRIPTION

**termkey\_get\_fd**() returns the file descriptor that the [**termkey**(7)](/termkey/7.md) instance is using to read bytes from.

## RETURN VALUE

**termkey\_get\_fd**() returns the current file descriptor, or -1 if no file descriptor is associated with this instance.

## SEE ALSO

[**termkey\_new**(3)](/termkey_new/3.md), **termkey\_get\_flags**(3), [**termkey**(7)](/termkey/7.md)
