Set the SDL error message for the current thread.
Defined in <SDL3/SDL_error.h>
fmt | a printf()-style message format string |
... | additional parameters matching % tokens in the fmt string, if any |
Returns always -1.
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:
This function is available since SDL 3.0.0.
int errorCode = 0;
/* ... */
errorCode = -37;
/* ... */
if (errorCode < 0)
SDL_SetError("Something unexpected happened: Error Code %d", errorCode);