logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

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

Availability

       This function is available since SDL 3.2.0.

Simple Directmedia Layer                           SDL 3.2.10                                    SDL_strtok_r(3)

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.

Header File

       Defined in SDL3/SDL_stdinc.h

Name

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

Return Value

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

Synopsis

#include"SDL3/SDL.h"char*SDL_strtok_r(char*str,constchar*delim,char**saveptr);

Thread Safety

       It is safe to call this function from any thread.

See Also