---
name: "scancode_to_ascii"
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_ascii"
---

# scancode\_to\_ascii(3alleg)

Converts a scancode to an ASCII character. Allegro game programming library.

## NAME

scancode\_to\_ascii - Converts a scancode to an ASCII character. Allegro game programming library.

## SYNOPSIS

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

**int scancode\_to\_ascii(int scancode);**

## DESCRIPTION

Converts the given scancode to an ASCII character for that key (mangling Unicode values), returning the unshifted uncapslocked result of pressing the key, or zero if the key isn't a character-generating key or the lookup can't be done. The lookup cannot be done for keys like the F1-F12 keys or the cursor keys, and some drivers will only return approximate values. Generally, if you want to display the name of a key to the user, you should use the scancode\_to\_name function.

Example:

```
   int ascii;
   ...
   ascii = scancode_to_ascii(scancode);
   allegro_message("You pressed '%c'\n", ascii);
```

## SEE ALSO

[**scancode\_to\_name**(3alleg)](/scancode_to_name/3alleg.md)
