al_ustr_size_utf16(3alleg5)

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

✨ al_ustr_size_utf16 β€” Allegro 5 API ✨

okay bestie, so you know how this whole page lives in the Allegro 5 API section of the al_ustr_size_utf16(3alleg5) manual? yeah. that's the vibe. πŸ’–


🌸 SYNOPSIS 🌸

#include <allegro5/allegro.h>

size_t al_ustr_size_utf16(const ALLEGRO_USTR *us)

like, literally that. that's the whole thing. no cap. 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

so this function hands you back the number of bytes you'd need to encode that string in UTF-16 β€” and yes, it counts the terminating 0 too, don't forget the lil guy, he matters πŸ’…

the way you'd usually use it? you call this first, before al_ustr_encode_utf16(3alleg5), purely to figure out how big your buffer needs to be before you go ahead and allocate it. it's giving "measure twice, cut once" but make it Unicode. πŸ‘‘

not me being the pre-flight check for your buffer allocation. main character energy fr fr. 🌈

πŸ‘‘ SEE ALSO πŸ‘‘


k bye bestie, go allocate responsibly πŸ’œ

this lil page came straight out of the Allegro reference manual β€” al_ustr_size_utf16(3alleg5) edition, periodt πŸŽ€βœ¨πŸŒΈ

πŸ“¦ where this page comes from