SDL_wcslcpy(3)
π SDL_wcslcpy π
okay bestie, welcome to the SDL_wcslcpy(3) page, part of the SDL3 functions crew β¨ this one is Copy a wide string, and she is lowkey iconic for it π
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_stdinc.h>
size_t SDL_wcslcpy(wchar_t *dst, const wchar_t *src, size_t maxlen);
like, that's the whole vibe. three args, one return, no drama π
π¦ DESCRIPTION π¦
so here's the tea β this function copies maxlen - 1 wide characters from src to dst, and then appends a null terminator. that's it. that's the whole job. she's a copy girlie and she knows it π
β οΈ<red>BIG ONE:srcanddstmust not overlap.</red>β οΈ like, not even a little. don't do it. no cap π
and if maxlen is 0? bestie, nothing happens. no wide characters are copied and no null terminator is written. it's giving "I'm not doing that" energy π zero. nada. the function just sits there.
β¨ FUNCTION PARAMETERS β¨
dstβ the destination buffer, the place where the copies go π she must not beNULL, and she must not overlap withsrc. that's the rule, fr fr.srcβ the null-terminated wide string to copy. the source material, the main character π must not beNULL, and must not overlap withdst. (yes we said it twice, because it matters twice π«Ά)maxlenβ the length (in wide characters) of the destination buffer. it's how much roomdsthas, and the function respects it religiously π§
π RETURN VALUE π
she hands you back the length (in wide characters, excluding the null terminator) of src. so like, how long the source was β not how much got copied. don't get it twisted bestie π
π THREAD SAFETY π
it is safe to call this function from any thread. yes queen, multi-threaded, unbothered, moisturized, in her lane π β¨
β AVAILABILITY β
this function is available since SDL 3.2.0. if your SDL is older than that... she doesn't exist yet, sorry babe π
π SEE ALSO π
SDL_wcslcat(3)β the append version, if you're feeling concatenate-y π
okay that's the page!! and just so you know where all this came from: it's from Simple Directmedia Layer, shipped as SDL 3.4.18 πΈ so yeah, that's the version, that's the source, and the doc header says SDL_wcslcpy(3) up top and SDL_wcslcpy(3) again down at the bottom, because symmetry is also iconic π¦β¨ bye bestie, go copy a wide string responsibly π
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms