uconvert_size(3)
β¨ uconvert_size(3) β¨
okay bestie, welcome to the Allegro manual β this one's uconvert_size, and it's literally the girl who tells you how much room your string is gonna need before you convert it. no cap. π
πΈ NAME πΈ
uconvert_size β number of bytes needed to store a string after conversion. it's from the Allegro game programming library, iykyk π
π¦ SYNOPSIS π¦
#include <allegro.h>
int uconvert_size(const char *s, int type, int newtype);
π DESCRIPTION π
so here's the vibe: uconvert_size figures out how many bytes you're gonna need to store the string s after it gets converted from type to newtype. and yes, that count includes the mandatory zero terminator of the string β she's thorough, she's not gonna let you forget the null. periodt. π
also!! you can use U_CURRENT for either type or newtype and it's a lil shortcut that means "whatever text encoding format is currently selected". iconic behavior honestly. β¨
example time, bestie:
length = uconvert_size(old_string, U_CURRENT, U_UNICODE);
new_string = malloc(length);
ustrcpy(new_string, old_string);
see how she's just doing her lil thing, sizing it up so malloc knows what's up? π«Ά
π RETURN VALUE π
returns the number of bytes required to store the string after conversion. that's it, that's the tea. π
π SEE ALSO π
no guessing, no drama β just bytes. go forth and convert, queen π
Allegro version 4.4.3 β mwah, that's the whole page, uconvert_size(3) and all, dated with the version like a lil time capsule πβ¨ byeee π¦
π¦ where this page comes from
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms