usetat(3)

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

✨ NAME ✨

okay bestie, meet usetat(3) from the Allegro manual β€” it replaces a character in a string, and it's part of the Allegro game programming library. periodt. πŸ’…


🌸 SYNOPSIS 🌸

#include <allegro.h>

int usetat(char *s, int index, int c);

πŸ¦‹ DESCRIPTION πŸ¦‹

So like, usetat replaces the character at the specified index in the string with value c, and it handles any adjustments for variable width data β€” ie. if c encodes to a different width than the previous value at that location. It's giving byte-level awareness, no cap. ✨

If index is negative, it counts backward from the end of the string. Yes, backwards. Main character energy. 😌

Example:

usetat(text_string, 2, letter_a);

πŸ’– RETURN VALUE πŸ’–

It returns the number of bytes by which the trailing part of the string was moved. This is of interest only with text encoding formats where characters have a variable length, like UTF-8. So if you're in UTF-8 land, this number matters. Otherwise, it's just a little receipt. 🧾

lowkey important: variable-length encodings are the whole reason this return value exists, fr fr.

πŸ”₯ SEE ALSO πŸ”₯


This page was brought to you by Allegro, version 4.4.3, and it's the usetat(3) manual. stay byte-savvy, bestie πŸ’–πŸ¦‹βœ¨

πŸ“¦ where this page comes from