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

# get\_executable\_name(3alleg)

Obtains the full path to the current executable. Allegro game programming library.

## NAME

get\_executable\_name - Obtains the full path to the current executable. Allegro game programming library.

## SYNOPSIS

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

**void get\_executable\_name(char \*buf, int size);**

## DESCRIPTION

Fills \`buf' with the full path to the current executable, writing at most \`size' bytes.  This generally comes from \`argv\[0\]' but on Unix systems it tries to get the information from the \`/proc' filesystem first, searching the directories specified in \`$PATH' if necessary. If this fails too, it tries to find the executable name from the output of the \`ps' command, using \`argv\[0\]' only as a last resort if all other options fail. Example:

```
   char name[200];
   ...
   get_executable_name(name, sizeof(name));
   allegro_message("Running `%s'\n", name);
```
