ustrncat(3alleg4)
β¨ NAME β¨
ustrncat β concatenates a string to another one, but like, with a size limit bestie π
and it's part of the Allegro game programming library π (yes this is ustrncat(3alleg4), we're in the Allegro manual, iykyk).
πΈ SYNOPSIS πΈ
#include <allegro.h>
char *ustrncat(char *dest, const char *src, int n);
π DESCRIPTION π
Okay so picture ustrcat() π«Ά β this is literally that, except no more than n characters from src get appended to the end of dest. That's the whole vibe. You're capping how much gets glued on.
Now here's the tea on how it actually behaves, and you need to know this fr fr:
- If the terminating null character in
srcgets reached beforencharacters have been written, then the null character is copied, but no other characters are written after it. The string just ends there, periodt. - If
ncharacters get written before a terminating null is encountered, the function appends its own null character todest, so thatn+1characters are written. So you getnof the content plus its own little null bow on top π.
β οΈ bestie. listen. You should try to avoid this function because it is very easy to overflow the destination buffer. Like, dangerously easy. Not cute. Use ustrzncat instead β that's the one you want. π
β RETURN VALUE β
The return value is just the value of dest. That's it. It hands you back your own dest pointer, main character behavior honestly π.
π¦ SEE ALSO π¦
k bye bestie, go read those other ones too, they're all linked up like a little friend group π
mwah π this page came from the Allegro manual, version 4.4.3, dated ustrncat(3alleg4) β slay, no cap, go write some safe string code β¨π
π¦ where this page comes from
- debian bookworm: allegro4-doc 2:4.4.3.1-3 Β· Allegro-gift-ware
- debian trixie: allegro4-doc 2:4.4.3.1-5 Β· Allegro-gift-ware
- ubuntu jammy: allegro4-doc 2:4.4.3.1-2 Β· Allegro-gift-ware
- ubuntu noble: allegro4-doc 2:4.4.3.1-4.1build3 Β· Allegro-gift-ware
- ubuntu questing: allegro4-doc 2:4.4.3.1-6
- ubuntu resolute: allegro4-doc 2:4.4.3.1-7 Β· Allegro-gift-ware
- ubuntu stonking: allegro4-doc 2:4.4.3.1-9 Β· Allegro-gift-ware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms