Function sdl2_sys::SDL_SetError

source ·
pub unsafe extern "C" fn SDL_SetError(
    fmt: *const c_char,
    ...
) -> c_int
Expand description

Set the SDL error message for the current thread.

Calling this function will replace any previous error message that was set.

This function always returns -1, since SDL frequently uses -1 to signify an failing result, leading to this idiom:

if (error_code) {
    return SDL_SetError("This operation has failed: %d", error_code);
}

\param fmt a printf()-style message format string \param … additional parameters matching % tokens in the fmt string, if any \returns always -1.

\since This function is available since SDL 2.0.0.

\sa SDL_ClearError \sa SDL_GetError