---
name: "key_defined"
section: "3"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/key_defined"
---

# key\_defined(3)

obtain key code for an ncurses function key definition

## NAME

**key\_defined** - obtain key code for an *ncurses* function key definition

## SYNOPSIS

```
#include <curses.h>
```

**int key\_defined(const char \*** *definition***);**

## DESCRIPTION

**The** **key\_defined** *ncurses* **extension permits a** *curses* **application to determine the function key code,** **if any,** **to which the string** *definition* **is bound.**

## RETURN VALUE

**key\_defined** **returns the first key code to which** *definition* **is bound if any exists.** **If none does,** **it returns** **0**. **If** *definition* **is a prefix of another bound definition,** **key\_defined** **returns** **-1**.

## EXTENSIONS

**key\_defined** **is an** *ncurses* **extension.**

## PORTABILITY

**Applications employing** *ncurses* **extensions should condition their use on the visibility of the** **NCURSES\_VERSION** **preprocessor macro.**

## AUTHORS

**Thomas Dickey**

## SEE ALSO

**curses(3X),** **define\_key(3X),** **keybound(3X),** **keyok(3X)**
