Wiki Page Content

Differences between revisions 7 and 8
Revision 7 as of 2010-08-27 22:09:52
Size: 1160
Editor: SheenaSmith
Comment: add 'draft' note
Revision 8 as of 2010-08-29 19:06:57
Size: 1074
Editor: SheenaSmith
Comment: update content (w/ Sam); remove 'draft' note
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
||<tablewidth="100%" style="color: #FF0000;" :> DRAFT||
Line 12: Line 11:
char* SDL_GetError(void) const char* SDL_GetError(void)
Line 18: Line 17:
*<<BR>>This string is statically allocated and must not be freed by the user. <<BR>>* This string is statically allocated and must not be freed by the user.
Line 22: Line 21:
if (SDL_Init( SDL_INIT_EVERYTHING ) == -1) { if (SDL_Init( SDL_INIT_EVERYTHING ) <0) {
Line 27: Line 26:
*<<BR>>Note: Although this example uses [[SDL_Init]](), [[SDL_GetError]]() provides an error message for any failed SDL operation. <<BR>>* Note: Although this example uses [[SDL_Init]](), [[SDL_GetError]]() provides an error message for any failed SDL operation.
Line 34: Line 33:
 .[[SDL_SetError]] *  .[[SDL_SetError]]

SDL_GetError

Use this function to retrieve a message about the last error that occurred.

Syntax

const char* SDL_GetError(void)

Return Value

Returns a message with information about the specific error that occurred, or an empty string if there hasn't been an error since the last call to SDL_ClearError().

This string is statically allocated and must not be freed by the user.

Code Examples

if (SDL_Init( SDL_INIT_EVERYTHING ) <0) {
    // Unrecoverable error, exit here.
    printf("SDL_Init failed: %s\n", SDL_GetError());
}

Note: Although this example uses SDL_Init(), SDL_GetError() provides an error message for any failed SDL operation.

Remarks

It is possible for multiple errors to occur before calling SDL_GetError(). Only the last error is returned.


CategoryAPI, CategoryError

None: SDL_GetError (last edited 2016-05-11 20:27:55 by PhilippWiesemann)

(Page Info.)
Feedback
Please include your contact information if you'd like to receive a reply.
Submit