al_ustr_new_from_utf16(3alleg5)

πŸ“¦
version 5.2.11.3 Β· 4 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– al_ustr_new_from_utf16 πŸ’–

okay bestie, welcome to the al_ustr_new_from_utf16(3alleg5) page, part of the Allegro 5 API ✨ she's a lil function, she's in the Allegro reference manual, and she is so good at exactly one thing. let's get into it 🫢


✨ NAME ✨

al_ustr_new_from_utf16 β€” it's giving Allegro 5 API, no cap πŸ‘‘


🌸 SYNOPSIS 🌸

#include <allegro5/allegro.h>

ALLEGRO_USTR *al_ustr_new_from_utf16(uint16_t const *s)

like… look at her. one include, one function, zero drama πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

So here's the tea, bestie πŸ“: this function creates a new string and puts a copy of s inside it. That's it, that's the whole job, and she eats every time 😌

But hold up, there are rules:

  • The string s has to be 0-terminated. The zero is the vibe check β€” when the function hits it, that's the end of the line, periodt.
  • The string s must be encoded as UTF-16 β€” like, actually UTF-16, bestie. Don't roll up with some other encoding and act surprised. πŸ™ˆ
and then β€” and this is the important part, do NOT forget this β€” the string you get back must eventually be freed with al_ustr_free(3alleg5). It's not optional, it's not a suggestion, it's not "eh I'll do it later". Free your string. Your string is not gonna free itself, and that's on memory leaks πŸ’€

🌈 SEE ALSO 🌈

  • al_ustr_new(3alleg5) β€” her cousin, her sister, her other option when your data isn't in UTF-16 🧚

and that's the whole page, bestie!! this was the Allegro reference manual, al_ustr_new_from_utf16(3alleg5), Allegro version 5 β€” go free your strings and slay the day, ily, mwah πŸ’–πŸŽ€βœ¨

πŸ“¦ where this page comes from