SDL_strlcat(3)

πŸ’– SDL_strlcat πŸ’–

okay bestie, welcome to the SDL3 FUNCTIONS corner of the man pages, this one's about SDL_strlcat and it's lowkey a glow-up over the chaotic string functions your ancestors used. pull up a chair 🫢


✨ NAME ✨

SDL_strlcat β€” concatenate strings, but the safe way, no cap πŸ’…


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_stdinc.h>

size_t SDL_strlcat(char *dst, const char *src, size_t maxlen);

πŸ¦‹ DESCRIPTION πŸ¦‹

so the vibe is: this function appends up to maxlen - SDL_strlen(dst) - 1 characters from src to the end of the string that's already chilling in dst, and then it appends a null terminator. that's it. that's the whole job. iconic. ✨

src and dst must not overlap. like, at all. they are not in a situationship, they need their own space 🚫

and if maxlen - SDL_strlen(dst) - 1 works out to less than or equal to 0? then dst stays completely unmodified. untouched. not a single character moved. it's giving "no thoughts, head empty" πŸ“


πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • dst β€” the destination buffer, and it already has to contain the first null-terminated string. must not be NULL, and must not overlap with src.
  • src β€” the second null-terminated string. must not be NULL, and must not overlap with dst.
  • maxlen β€” the length (in characters) of the destination buffer. the whole buffer, bestie, not just the free space left in it πŸ’€

πŸ’œ RETURN VALUE πŸ’œ

it returns the length (in characters, null terminator not included, she's not invited) of the string in dst plus the length of src. so basically the size of the combined vibe, in characters. πŸ“


πŸ”₯ THREAD SAFETY πŸ”₯

it is safe to call this function from any thread. go wild, queen, no locks required πŸ‘‘


⭐ AVAILABILITY ⭐

this function is available since SDL 3.2.0. if your SDL is older than that, bestie, you're out of luck, go update πŸ™ˆ


🌈 SEE ALSO 🌈


and that's the tea, fr fr. go forth and concatenate responsibly πŸ’–

this page came to you courtesy of Simple Directmedia Layer, version SDL 3.4.18 β€” mwah, take care of her 🫢✨

πŸ“¦ where this page comes from