ustrdup(3)

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

✨ NAME ✨

Okay bestie, meet ustrdup(3) β€” the Allegro manual's little string-duplicating icon. It's literally in the Allegro game programming library, and it does exactly what it says: duplicates a string. No cap. πŸ’–

🌸 SYNOPSIS 🌸

#include <allegro.h>

char *ustrdup(const char *src)

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so this function copies the null-terminated string src into a newly allocated area of memory β€” effectively duplicating it, like a clone but for chars. ✨ iconic ✨

Example, because seeing it is believing:

          void manipulate_string(const char *input_string)
          {
             char *temp_buffer = ustrdup(input_string);
             /* Now we can modify temp_buffer */
             ...

πŸ‘‘ RETURN VALUE πŸ‘‘

It returns the newly allocated string, bestie. But listen: this memory must be freed by the caller β€” that's you, so don't ghost it. 🫢 It returns NULL if it cannot allocate space for the duplicated string. Periodt. πŸ’…

πŸ’… SEE ALSO πŸ’…


Allegro version 4.4.3, and that's the footer tea. The date didn't show up, but the vibes are timeless. Bye bestie! πŸŽ€

πŸ“¦ where this page comes from