---
name: "SDL_strlcpy"
section: "3"
platform: "linux"
package: "libsdl3-doc"
version: "3.2.10+ds-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/SDL_strlcpy"
---

# SDL\_strlcpy(3)

Copy a string.

## NAME

SDL\_strlcpy - Copy a string.

## HEADER FILE

Defined in SDL3/SDL\_stdinc.h

## SYNOPSIS

```
#include "SDL3/SDL.h"
```

**size\_t SDL\_strlcpy(char \*dst, const char \*src, size\_t maxlen);**

## DESCRIPTION

This function copies up to **maxlen**

• 1 characters from **src** to **dst** , then appends a null terminator.

If **maxlen** is 0, no characters are copied and no null terminator is written.

If you want to copy an UTF-8 string but need to ensure that multi-byte sequences are not truncated, consider using

**SDL\_utf8strlcpy** ().

## FUNCTION PARAMETERS

- *dst*

  The destination buffer. Must not be NULL, and must not overlap with **src** .

- *src*

  The null-terminated string to copy. Must not be NULL, and must not overlap with **dst** .

- *maxlen*

  The length (in characters) of the destination buffer.

## RETURN VALUE

Returns the length (in characters, excluding the null terminator) of **src** .

## THREAD SAFETY

It is safe to call this function from any thread.

## AVAILABILITY

This function is available since SDL 3.2.0.

## SEE ALSO

**•**(3), [**SDL\_strlcat**(3)](/SDL_strlcat/3.md), **•**(3), [**SDL\_utf8strlcpy**(3)](/SDL_utf8strlcpy/3.md)
