ustrdup(3alleg4)
π¦ NAME π¦
ustrdup β duplicates a string. From the Allegro game programming library, aka the 3alleg4 manual bestie, we been knew π
β¨ SYNOPSIS β¨
#include <allegro.h>
char *ustrdup(const char *src)
πΈ DESCRIPTION πΈ
okay so. this function takes the null-terminated string src and copies it into a freshly allocated chunk of memory β like, brand new, nobody else's, all yours. it's literally duplicating the string fr fr π«Ά
here's the vibe in action:
void manipulate_string(const char *input_string)
{
char *temp_buffer = ustrdup(input_string);
/* Now we can modify temp_buffer */
...
see how temp_buffer is a whole separate copy? that's the whole point, no cap. you can do whatever you want to it and the original stays untouched, icon that she is π
π RETURN VALUE π
she hands you back the newly allocated string β¨ β and like, the caller has to free that memory, that's on you bestie, don't just leave her hanging π
and if she can't allocate space for the duplicated string? you get NULL. that's it. that's the tea π
π SEE ALSO π
and that's the whole page, babe π§ this was Allegro, version 4.4.3, and yes the ustrdup(3alleg4) girlies ate this one up. go free your strings, mwah π
π¦ 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