SDL School

API reference / Files, memory, and strings

SDL_strchr

Function, SDL3

Finds the first copy of a character in a string.

Declaration

#include <SDL3/SDL.h>

char * SDL_strchr(const char *str, int c);

Parameters

strThe string.
cThe character.

Return value

A pointer to the character. For a string without it, the result is NULL.

Example

Read a file
bar = SDL_strchr(line, '|');

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

In SDL2

The name is the same.

See also