SDL_SetError

Use this function to set the SDL error message. 使用函数可以设置一个SDL错误信息。

Syntax 函数声明

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

Function Parameters 函数参数

fmta printf() style message format string 像printf函数一样的字符串
additional parameters matching % tokens in the fmt string, if any
函数的格式化输出的参数列表

Return Value 返回值

Returns always -1. 总是返回 -1

Code Examples

  1. SDL_SetError("Something unexpected happened!");
  2. int errorCode = 0;
  3. ...
  4. errorCode = -37;
  5. ...
  6. if (errorCode < 0)
  7. SDL_SetError("Something unexpected happened: Error Code %d", errorCode);

Remarks 注意

Calling this function will replace any previous error message that was set. 这个函数会覆盖之前设置的错误。

Related Functions 相关函数

SDL_ClearError

SDL_GetError


@DXkite Translated.