sdlStrlcat function

int sdlStrlcat(
  1. Pointer<NativeType> arg0,
  2. String? src,
  3. int maxlen
)

Concatenate strings.

This function appends up to maxlen - SDL_strlen(dst) - 1 characters from src to the end of the string in dst, then appends a null terminator.

src and dst must not overlap.

If maxlen - SDL_strlen(dst) - 1 is less than or equal to 0, then dst is unmodified.

\param dst The destination buffer already containing the first null-terminated string. Must not be NULL and must not overlap with src. \param src The second null-terminated string. Must not be NULL, and must not overlap with dst. \param maxlen The length (in characters) of the destination buffer. \returns The length (in characters, excluding the null terminator) of the string in dst plus the length of src.

\threadsafety It is safe to call this function from any thread.

\since This function is available since SDL 3.1.3.

\sa SDL_strlcpy

extern SDL_DECLSPEC size_t SDLCALL SDL_strlcat(SDL_INOUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen)

Implementation

int sdlStrlcat(Pointer<NativeType> arg0, String? src, int maxlen) {
  final sdlStrlcatLookupFunction = libSdl3.lookupFunction<
      Uint32 Function(
          Pointer<NativeType> arg0, Pointer<Utf8> src, Uint32 maxlen),
      int Function(Pointer<NativeType> arg0, Pointer<Utf8> src,
          int maxlen)>('SDL_strlcat');
  final srcPointer = src != null ? src.toNativeUtf8() : nullptr;
  final result = sdlStrlcatLookupFunction(arg0, srcPointer, maxlen);
  calloc.free(srcPointer);
  return result;
}