SDL School

API reference / Files, memory, and strings

SDL_strlen

Function, SDL3

Gets the length of a string, not counting the null character.

Declaration

#include <SDL3/SDL.h>

size_t SDL_strlen(const char *str);

Parameters

strThe string.

Return value

The length in bytes.

Example

Read a file
size_t length = SDL_strlen(line);

See this code run in Read a file. Download the full program (.zip)

In SDL2

The name is the same.

See also