---
name: "scancode_to_name"
section: "3alleg"
platform: "linux"
package: "liballegro-doc"
version: "2:4.2.2-2.2"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/scancode_to_name"
---

# scancode\_to\_name(3alleg)

Converts a scancode to a key name. Allegro game programming library.

## NAME

scancode\_to\_name - Converts a scancode to a key name. Allegro game programming library.

## SYNOPSIS

**#include \<allegro.h\>**

**const char \*scancode\_to\_name(int scancode);**

## DESCRIPTION

This function returns a string pointer containing the name of they key with the given scancode. This is useful if you e.g. let the user choose a key for some action, and want to display something more meaningful than just the scancode. Example:

```
   char const *keyname = scancode_to_name(scancode);
   allegro_message("You pressed the %s key.", keyname);
```

## SEE ALSO

[**scancode\_to\_ascii**(3alleg)](/scancode_to_ascii/3alleg.md), [**exkeys**(3alleg)](/exkeys/3alleg.md)
