SDL  2.0
SDL_error.h File Reference
#include "SDL_stdinc.h"
#include "begin_code.h"
#include "close_code.h"
+ Include dependency graph for SDL_error.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int SDL_SetError (SDL_PRINTF_FORMAT_STRING const char *fmt,...) SDL_PRINTF_VARARG_FUNC(1)
 Set the error message for the current thread. More...
 
const char * SDL_GetError (void)
 Get the last error message that was set. More...
 
char * SDL_GetErrorMsg (char *errstr, int maxlen)
 Get the last error message that was set for the current thread. More...
 
void SDL_ClearError (void)
 Clear the error message for the current thread. More...
 

Internal error functions

Private error reporting function - used internally.

#define SDL_OutOfMemory()   SDL_Error(SDL_ENOMEM)
 
#define SDL_Unsupported()   SDL_Error(SDL_UNSUPPORTED)
 
#define SDL_InvalidParamError(param)   SDL_SetError("Parameter '%s' is invalid", (param))
 
enum  SDL_errorcode {
  SDL_ENOMEM ,
  SDL_EFREAD ,
  SDL_EFWRITE ,
  SDL_EFSEEK ,
  SDL_UNSUPPORTED ,
  SDL_LASTERROR
}
 
int SDL_Error (SDL_errorcode code)
 

Detailed Description

Simple error message routines for SDL.

Definition in file SDL_error.h.

Macro Definition Documentation

◆ SDL_InvalidParamError

#define SDL_InvalidParamError (   param)    SDL_SetError("Parameter '%s' is invalid", (param))

Definition at line 90 of file SDL_error.h.

◆ SDL_OutOfMemory

#define SDL_OutOfMemory ( )    SDL_Error(SDL_ENOMEM)

Definition at line 88 of file SDL_error.h.

◆ SDL_Unsupported

#define SDL_Unsupported ( )    SDL_Error(SDL_UNSUPPORTED)

Definition at line 89 of file SDL_error.h.

Enumeration Type Documentation

◆ SDL_errorcode

Enumerator
SDL_ENOMEM 
SDL_EFREAD 
SDL_EFWRITE 
SDL_EFSEEK 
SDL_UNSUPPORTED 
SDL_LASTERROR 

Definition at line 91 of file SDL_error.h.

92 {
93  SDL_ENOMEM,
94  SDL_EFREAD,
96  SDL_EFSEEK,
SDL_errorcode
Definition: SDL_error.h:92
@ SDL_EFSEEK
Definition: SDL_error.h:96
@ SDL_LASTERROR
Definition: SDL_error.h:98
@ SDL_EFWRITE
Definition: SDL_error.h:95
@ SDL_UNSUPPORTED
Definition: SDL_error.h:97
@ SDL_EFREAD
Definition: SDL_error.h:94
@ SDL_ENOMEM
Definition: SDL_error.h:93

Function Documentation

◆ SDL_ClearError()

void SDL_ClearError ( void  )

Clear the error message for the current thread.

◆ SDL_Error()

int SDL_Error ( SDL_errorcode  code)

◆ SDL_GetError()

const char* SDL_GetError ( void  )

Get the last error message that was set.

SDL API functions may set error messages and then succeed, so you should only use the error value if a function fails.

This returns a pointer to a static buffer for convenience and should not be called by multiple threads simultaneously.

Returns
a pointer to the last error message that was set

◆ SDL_GetErrorMsg()

char* SDL_GetErrorMsg ( char *  errstr,
int  maxlen 
)

Get the last error message that was set for the current thread.

SDL API functions may set error messages and then succeed, so you should only use the error value if a function fails.

Parameters
errstrA buffer to fill with the last error message that was set for the current thread
maxlenThe size of the buffer pointed to by the errstr parameter
Returns
errstr

◆ SDL_SetError()

int SDL_SetError ( SDL_PRINTF_FORMAT_STRING const char *  fmt,
  ... 
)

Set the error message for the current thread.

Returns
-1, there is no error handling for this function