SDL_wcslcat(3)

πŸ’– SDL_wcslcat(3) β€” the SDL3 functions girlies πŸ’–

okay bestie, so this is SDL_wcslcat from the SDL3 FUNCTIONS lineup, and it's genuinely one of those little helpers that you'll be obsessed with once it clicks. wide strings, concatenation, no drama. let's get into it 🫢


✨ NAME ✨

SDL_wcslcat β€” concatenate wide strings. that's it, that's the whole job πŸ’…


✨ SYNOPSIS ✨

#include <SDL3/SDL_stdinc.h>

size_t SDL_wcslcat(wchar_t *dst, const wchar_t *src, size_t maxlen);

look at her. three args, returns a size_t, no cap. 🌸


✨ DESCRIPTION ✨

so here's the vibe: this function appends up to maxlen - SDL_wcslen(dst) - 1 wide characters from src to the end of the wide string sitting in dst, and then β€” because she's polite β€” she appends a null terminator at the end. ✨

IMPORTANT, bestie, fr fr: src and dst must not overlap. like, do not do that. it's giving chaos.

and here's the other little detail you need to internalise: if maxlen - SDL_wcslen(dst) - 1 is less than or equal to 0, then dst is unmodified. like, she just doesn't touch it. iconic behaviour honestly. πŸŽ€


✨ FUNCTION PARAMETERS ✨

  • dst β€” the destination buffer, which already has the first null-terminated wide string chilling in it. must not be NULL, and must not overlap with src. πŸ’–
  • src β€” the second null-terminated wide string, the one getting appended. must not be NULL, and must not overlap with dst. πŸ¦‹
  • maxlen β€” the length (in wide characters) of the destination buffer. so like, how much room dst actually has. that's your limit, queen. πŸ‘‘

✨ RETURN VALUE ✨

she returns the length (in wide characters, excluding the null terminator) of the string in dst plus the length of src.

so it's not "how many chars did i just append", it's the whole combined length. read that twice, i promise it matters. 😭


✨ THREAD SAFETY ✨

it is safe to call this function from any thread. no locking, no stress, just vibes. 🌈


✨ AVAILABILITY ✨

this function is available since SDL 3.2.0. so if you're on anything older, sorry babe, she's not there yet. πŸ™ˆ


✨ SEE ALSO ✨

  • SDL_wcslcpy(3) β€” her sister, the copy girlie. same energy, different job. πŸ“

and that's the whole page, bestie!! go forth and concatenate responsibly. no overlapping buffers in this group chat. 🧚

this has been a Simple Directmedia Layer production, brought to you by SDL 3.4.18 β€” mwah, catch you in the next manpage, ily!! πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…πŸ«Ά

πŸ“¦ where this page comes from