append_filename(3)

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

✨ append_filename(3) ✨

okay bestie so this is a page straight out of the Allegro manual β€” it's the append_filename one, and it lives in the Allegro game programming library πŸŽ€. It's giving "tiny utility function that saves your whole life," fr fr.


πŸ’– NAME πŸ’–

append_filename β€” concatenates a filename to a path. Part of the Allegro game programming library. πŸ¦‹


🌸 SYNOPSIS 🌸

#include <allegro.h>

char *append_filename(char *dest, const char *path, const char
*filename, int size);

✨ DESCRIPTION ✨

okay so what this does: it takes the filename you hand it and glues it onto the end of the path you hand it, and it writes at most size bytes into the dest buffer. no cap. πŸ’…

and here's the cute part β€” if path doesn't already have a trailing path separator, this function will add one for you if it needs one. it's thoughtful like that. 🫢

also!! you can literally use the same buffer as both input and output, because internally Allegro works on a copy of the input before it ever touches dest. so no weird self-clobbering situation, we love a safe girlie. 😌✨

example time, here's the whole vibe:

append_filename(buf, "/home/user",
                "prog.bin", sizeof(buf));

πŸ¦‹ RETURN VALUE πŸ¦‹

returns a copy of the dest parameter. that's it, that's the whole thing. πŸ’œ


πŸŽ€ SEE ALSO πŸŽ€


Allegro, version 4.4.3 β€” and this page itself is append_filename(3), mwah πŸ’‹. thanks for coming to my ted talk bestie, go build something iconic πŸŒˆπŸ‘‘πŸ’–

πŸ“¦ where this page comes from