---
name: "SDL_wcslen"
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_wcslen"
---

# SDL\_wcslen(3)

This works exactly like wcslen() but doesn't require access to a C runtime.

## NAME

SDL\_wcslen - This works exactly like wcslen() but doesn't require access to a C runtime.

## HEADER FILE

Defined in SDL3/SDL\_stdinc.h

## SYNOPSIS

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

**size\_t SDL\_wcslen(const wchar\_t \*wstr);**

## DESCRIPTION

Counts the number of wchar\_t values in **wstr** , excluding the null terminator.

Like  **SDL\_strlen**\
  only counts bytes and not codepoints in a UTF-8 string, this counts wchar\_t values in a string, even if the string's encoding is of variable width, like UTF-16.

Also be aware that wchar\_t is different sizes on different platforms (4 bytes on Linux, 2 on Windows, etc).

## FUNCTION PARAMETERS

- *wstr*

  The null-terminated wide string to read. Must not be NULL.

## RETURN VALUE

Returns the length (in wchar\_t values, excluding the null terminator) of **wstr** .

## 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\_wcsnlen**(3)](/SDL_wcsnlen/3.md), **•**(3), [**SDL\_utf8strlen**(3)](/SDL_utf8strlen/3.md), **•**(3), [**SDL\_utf8strnlen**(3)](/SDL_utf8strnlen/3.md)
