uconvert_size(3alleg4)

✨ NAME ✨

okay bestie, welcome to the uconvert_size(3alleg4) page from the Allegro manual πŸ’–

uconvert_size β€” Number of bytes needed to store a string after conversion. Part of the Allegro game programming library. No cap, that's literally what she does. πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

you pull her in like this, periodt:

#include <allegro.h>

int uconvert_size(const char *s, int type, int newtype);

πŸ’– DESCRIPTION πŸ’–

Okay so picture this: you have the specified string s, and you need to find out how many bytes are required to store it after a conversion from type to newtype. That's the vibe. She counts the mandatory zero terminator of the string too β€” yes, the null terminator is included, she's not being skipped, bestie. 😌

You can use U_CURRENT for either type or newtype as a shortcut to represent whatever text encoding format is currently selected. It's giving "I don't have the exact encoding name rn, just use the current one." πŸ’…

Example, because seeing it is believing:

length = uconvert_size(old_string, U_CURRENT, U_UNICODE);
new_string = malloc(length);
ustrcpy(new_string, old_string);

🌈 RETURN VALUE 🌈

Returns the number of bytes required to store the string after conversion. That's the whole return value, and she ate. πŸ’…βœ¨


πŸ‘‘ SEE ALSO πŸ‘‘


mwah πŸ’‹ signing off from Allegro, version 4.4.3. stay iconic, bestie πŸ¦‹βœ¨