Wiki Page Content

Differences between revisions 14 and 15
Revision 14 as of 2013-07-22 20:29:29
Size: 915
Comment: Updated to match SDL_error.h
Revision 15 as of 2016-05-11 20:21:39
Size: 933
Comment: Moved second parameter on a new line, see SGFunctions.
Deletions are marked like this. Additions are marked like this.
Line 10: Line 10:
int SDL_SetError(const char* fmt, ...) int SDL_SetError(const char* fmt,


Use this function to set the SDL error string.


int SDL_SetError(const char* fmt,

Function Parameters


a printf() style message format string


additional parameters matching % tokens in the fmt string, if any

Return Value

Returns always -1.

Code Examples

SDL_SetError("Something unexpected happened!");

int errorCode = 0;
errorCode = -37;
if (errorCode < 0)
    SDL_SetError("Something unexpected happened: Error Code %d", errorCode);


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

CategoryAPI, CategoryError

None: SDL_SetError (last edited 2016-05-11 20:22:50 by PhilippWiesemann)

Please include your contact information if you'd like to receive a reply.