do_uconvert(3)

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

πŸ’– do_uconvert(3) πŸ’–

okay bestie, welcome to the Allegro manual β€” this one's do_uconvert, and she's from the Allegro game programming library. literally the encoding glow-up station, no cap. ✨


🌸 SYNOPSIS 🌸

#include <allegro.h>

void do_uconvert(const char *s, int type, char *buf, int newtype, int size);

πŸ¦‹ DESCRIPTION πŸ¦‹

So here's the vibe: she takes your string s, which is currently living its life as type, and she converts it over to newtype, dropping at most size bytes into the output buf. glow-up complete. πŸ’…

Both type params can flex the value U_CURRENT, which is the shortcut for "whatever encoding format is selected rn". iconic, honestly.

Example, because I love a demonstration:

char temp_string[256];
do_uconvert(input_string, U_CURRENT, temp_string, U_ASCII, 256);
🚨 okay listen, this part is IMPORTANT. Even for an empty string, your destination string still needs at least enough bytes to hold the terminating null character, and your size parameter has to reflect that. fr fr. If you don't, 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 vibe, that's a crash. count your bytes bestie 🫢

πŸ‘‘ SEE ALSO πŸ‘‘


and that's the whole page, mwah πŸ’œ thanks for reading, go forth and convert responsibly 🧚🌸

this little writeup is brought to you by Allegro, version 4.4.3 β€” she's an icon, she's a legend, and she IS the moment. β­πŸŽ€ bye bestie! πŸ¦‹

πŸ“¦ where this page comes from