ustrzcat(3)

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

πŸ’– ustrzcat β€” the Allegro manual, but make it cute πŸ’–

okay bestie, so this is a page from the Allegro game programming library manual, and today's main character is ustrzcat(3). she concatenates a string onto another one, but she's the ✨responsible✨ one because she lets you specify the size. periodt.


🌸 NAME 🌸

ustrzcat β€” concatenates a string to another one, specifying size. it's giving Allegro game programming library energy πŸŽ€


✨ SYNOPSIS ✨

#include <allegro.h>

char *ustrzcat(char *dest, int size, const char *src);

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the vibe: this function concatenates src onto the end of dest. and dest's length in bytes? that's what size is for, bestie. and the iconic part β€” dest is guaranteed to be null-terminated even when src is bigger than size. no cap, she's got your back πŸ’…

⚠️ okay now listen, this part is important, don't skip it: even for empty strings, your destination string has to have at least enough bytes to store the terminating null character, and your size parameter has to reflect that. otherwise? the debug version of Allegro will abort at an assertion, and the release version of Allegro will overrun the destination buffer. that's not a cute look, that's a buffer overrun. pls respect the size parameter, she's literally telling you what she needs 😭

πŸ‘‘ RETURN VALUE πŸ‘‘

returns the value of dest. that's it, that's the whole thing, she gives you back your own pointer 🫢


🌈 SEE ALSO 🌈

go read those too, iykyk πŸ’œ


and that's the tea, bestie πŸ“ this was ustrzcat(3) from Allegro, version 4.4.3 β€” the Allegro manual, and yes she ate πŸ’…βœ¨ bye now! πŸŽ€πŸ¦‹πŸ’–

πŸ“¦ where this page comes from