---
name: "get_extension"
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/get_extension"
---

# get\_extension(3alleg)

Returns a pointer to the extension of a filename. Allegro game programming library.

## NAME

get\_extension - Returns a pointer to the extension of a filename. Allegro game programming library.

## SYNOPSIS

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

**char \*get\_extension(const char \*filename);**

## DESCRIPTION

Finds out the extension of the filename (with or without path information). Example:

```
   get_executable_name(name, sizeof(name));
   allegro_message("The binary has the extension `%s'\n",
                   get_extension(name));
```

## RETURN VALUE

Returns a pointer to the portion of \`filename' where the extension starts, or a pointer to the trailing null character if there is no filename or it doesn't have extension.

## SEE ALSO

[**get\_filename**(3alleg)](/get_filename/3alleg.md), [**put\_backslash**(3alleg)](/put_backslash/3alleg.md), [**replace\_extension**(3alleg)](/replace_extension/3alleg.md)
