TICKIT_UTF8_PUT(3)

πŸ’– TICKIT_UTF8_PUT πŸ’–

okay bestie, welcome to the tickit_utf8_put page, straight out of the Library Functions Manual ✨ this one's a lil cutie: it's the function that takes a codepoint and yeets the right UTF-8 bytes into your buffer. lowkey iconic behavior.


πŸŽ€ NAME πŸŽ€

tickit_utf8_put β€” append a UTF-8 encoded codepoint to a buffer πŸ¦‹


✨ SYNOPSIS ✨

#include <tickit.h>

size_t tickit_utf8_put(char *str, size_t len, long codepoint);

Link with -ltickit. yes bestie you gotta link it, no cap πŸ’…


🌸 DESCRIPTION 🌸

so here's the tea, fr fr. tickit_utf8_put() appends bytes into a buffer so that the buffer represents the codepoint you handed it. the UTF-8 bytes go in directly, starting right at str, and then the function hands you back the total number of bytes it appended. that's it, that's the whole vibe. ✨

you tell it how much room it's got with len. and listen β€” if the buffer is not long enough, it does not half-write anything: the buffer gets left unmodified and you get -1 back instead. no messy leftovers, we love a clean exit 😌

also, plot twist: if str is NULL, the function doesn't write anything at all β€” it just returns the number of bytes it would need to represent that codepoint. perfect for when you're just doing a lil vibe check on the size first, iykyk 🧚

πŸ’€ IMPORTANT: this function does not expect your buffer to be NUL-terminated, and it will not terminate the buffer with a NUL byte when it's done. do not assume there's a '\0' waiting at the end. there is not. it's giving DIY energy, you handle that part yourself bestie πŸ™ˆ

πŸ”₯ RETURN VALUE πŸ”₯

tickit_utf8_put() returns the number of bytes appended to the buffer, or -1 if the buffer was not long enough. that's the whole menu πŸ“


πŸ‘‘ SEE ALSO πŸ‘‘

go read those too, they're the besties of this page 🫢


and that's a wrap on TICKIT_UTF8_PUT(3), Library Functions Manual edition β€” the footer said TICKIT_UTF8_PUT(3) and honestly? periodt. πŸ’–βœ¨πŸŽ€ go append some codepoints, main character 🌈⭐