---
name: "SDL_strtok_r"
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_strtok_r"
---

# SDL\_strtok\_r(3)

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

## NAME

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

## HEADER FILE

Defined in SDL3/SDL\_stdinc.h

## SYNOPSIS

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

**char \* SDL\_strtok\_r(char \*str, const char \*delim, char \*\*saveptr);**

## DESCRIPTION

Break a string up into a series of tokens.

To start tokenizing a new string, **str** should be the non-NULL address of the string to start tokenizing. Future calls to get the next token from the same string should specify a NULL.

Note that this function will overwrite pieces of **str** with null chars to split it into tokens. This function cannot be used with const/read-only strings! **saveptr** just needs to point to a **char**\* that can be overwritten; SDL will use this to save tokenizing state between calls. It is initialized if **str** is non-NULL, and used to resume tokenizing when **str** is NULL.

## FUNCTION PARAMETERS

- *str*

  the string to tokenize, or NULL to continue tokenizing.

- *delim*

  the delimiter string that separates tokens.

- *saveptr*

  pointer to a char \*, used for ongoing state.

## RETURN VALUE

Returns A pointer to the next token, or NULL if no tokens remain.

## THREAD SAFETY

It is safe to call this function from any thread.

## AVAILABILITY

This function is available since SDL 3.2.0.
