uinsert(3)
β¨ uinsert(3) β¨
okay bestie, welcome to the Allegro manual π this one's a lil function called uinsert, and it's literally the "scooch over, i'm getting in" of string manipulation. no cap.
πΈ NAME πΈ
uinsert β inserts a character in a string. part of the Allegro game programming library, and yes she's iconic π
π SYNOPSIS π
#include <allegro.h>
int uinsert(char *s, int index, int c);
π¦ DESCRIPTION π¦
so here's the tea β β uinsert takes that character c and slides it into the string s at the spot you picked, index. and the way it does that? it slides the rest of the data along to make room π«Ά like when your bestie squeezes onto the couch and everyone else has to shuffle down. no one gets deleted, everyone just moves.
and if index is negative? don't worry, she's flexible β a negative index counts backward from the end of the string π₯ so you can count from the back like it's a line at a concert.
here's the example straight from the source, keep it exact bestie:
uinsert(text_string, 0, prefix_letter);
that's her! inserting prefix_letter at position 0, aka the very front π
π RETURN VALUE π
she gives you back the number of bytes by which the trailing part of the string was moved. so like, receipts. how far did everybody have to scooch? now you know β¨
π SEE ALSO π
go read those too, they're all in the same friend group fr fr π§
β οΈ heads up bestie: make sure the string you're passing in actually has room for that extra character, because sliding data into a buffer that can't hold it is not the vibe. periodt.
Allegro, version 4.4.3 π β mwah, that's the whole page, thanks for reading my little manual moment, ily, bye ππβ¨
π¦ 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