Wiki Page Content

Differences between revisions 9 and 16 (spanning 7 versions)
Revision 9 as of 2010-08-29 19:10:54
Size: 688
Editor: SheenaSmith
Comment: update content (w/ Sam); remove 'draft' note
Revision 16 as of 2016-05-11 20:22:50
Size: 934
Comment: Changed wording of description.
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
Line 5: Line 4:
Use this function to set the SDL error string. Use this function to set the SDL error message.
Line 11: Line 10:
void SDL_SetError(const char* fmt, 
  ...)
int SDL_SetError(const char* fmt,
                 ...)
Line 14: Line 13:
== Function Parameters ==
||'''fmt''' ||a printf() style message format string ||
||'''...''' ||additional parameters matching % tokens in the '''fmt''' string, if any ||
Line 15: Line 17:
== Function Parameters ==
||'''fmt'''||a printf() style message format string||
||'''...'''||additional parameters matching % tokens in the '''fmt''' string, if any||
== Return Value ==
Returns always -1.
Line 23: Line 24:
{{{#!highlight cpp
int errorCode = 0;
...
errorCode = -37;
...
if (errorCode < 0)
    SDL_SetError("Something unexpected happened: Error Code %d", errorCode);
}}}
Line 25: Line 33:
''You can add useful comments here'' Calling this function will replace any previous error message that was set.
Line 28: Line 36:
 .[[SDL_ClearError]]
 .[[SDL_GetError]]
 . [[SDL_ClearError]]
 . [[SDL_GetError]]
Line 32: Line 40:
[[CategoryAPI]], [[CategoryError]] [[CategoryAPI]], CategoryError

SDL_SetError

Use this function to set the SDL error message.

Syntax

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

Function Parameters

fmt

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);

Remarks

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)

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