get_extension(3alleg4)
β¨ get_extension β¨
okay bestie, welcome to the get_extension page of the Allegro manual (yes that's the manual name, get_extension(3alleg4), we're in the Allegro game programming library era and it's giving retro royalty π).
NAME β get_extension β returns a pointer to the extension of a filename. Part of the Allegro game programming library, obviously π
πΈ SYNOPSIS πΈ
#include <allegro.h>
char *get_extension(const char *filename);
π DESCRIPTION π
So what it does is it sniffs out the extension of the filename you hand it β and it does NOT care whether you gave it path info or not, it handles both, no cap π«Ά. Here's the example straight from the source:
get_executable_name(name, sizeof(name));
allegro_message("The binary has the extension `%s'\n",
get_extension(name));
π RETURN VALUE π
It hands you back a pointer to the exact spot inside filename where the extension kicks in β¨.
BUT β and listen, this is the plot twist π β if there's no filename at all, or the thing just doesn't have an extension, you get a pointer to the trailing null character instead. Like, an empty vibe. Nothing to see here. π
π¦ SEE ALSO π¦
and that's the whole page, bestie, you ate it π
β¨ this was get_extension from Allegro version 4.4.3 β iconic behavior, fr fr ππ«Ά
π¦ where this page comes from
- debian bookworm: allegro4-doc 2:4.4.3.1-3 Β· Allegro-gift-ware
- debian trixie: allegro4-doc 2:4.4.3.1-5 Β· Allegro-gift-ware
- ubuntu jammy: allegro4-doc 2:4.4.3.1-2 Β· Allegro-gift-ware
- ubuntu noble: allegro4-doc 2:4.4.3.1-4.1build3 Β· Allegro-gift-ware
- ubuntu questing: allegro4-doc 2:4.4.3.1-6
- ubuntu resolute: allegro4-doc 2:4.4.3.1-7 Β· Allegro-gift-ware
- ubuntu stonking: allegro4-doc 2:4.4.3.1-9 Β· Allegro-gift-ware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms