get_extension(3)

πŸ“¦ version 4.4.3.1, in fedora 43, fedora 44

okay bestie, welcome to get_extension(3) from the Allegro manual πŸ’– It's a tiny filename-extension-finder and honestly? It's giving utility icon energy. ✨

🌸 NAME 🌸

get_extension β€” returns a pointer to the extension of a filename. Also, this whole thing lives in the Allegro game programming library, so you know it's iconic. πŸ‘‘

✨ SYNOPSIS ✨

Like, literally all you need is this, no cap:

#include <allegro.h>

char *get_extension(const char *filename);

πŸ’… DESCRIPTION πŸ’…

So what does it do? It finds out the extension of the filename (with or without path information). That's the whole vibe. πŸ¦‹

Example, because we love a little demo moment:

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

🫢 RETURN VALUE 🫢

It returns a pointer to the portion of filename where the extension starts. Or, if there is no filename or it doesn't have extension, you get a pointer to the trailing null character. So no extension? Still a pointer, just not a cute extension moment. 😭

πŸŽ€ SEE ALSO πŸŽ€

Go read these too, bestie:


Allegro, version 4.4.3, and this iconic page is get_extension(3). Byeee, go slay some filenames. πŸ’–βœ¨πŸ‘‘

πŸ“¦ where this page comes from