{The S-lang C Library Reference}: SLang_verror

Next Previous Contents

## 82. SLang_verror

Synopsis

  Signal an error with a message

Usage

  `void SLang_verror (int code, char *fmt, ...);`

Description

  The `SLang_verror` function sets `SLang_Error` to `code` if `SLang_Error` is 0. It also displays the error message implied by the `printf` variable argument list using `fmt` as the format.

Example

  > `

  >           FILE *open_file (char *file)
  >           {
  >              char *file = "my_file.dat";
  >              if (NULL == (fp = fopen (file, "w")))
  >                SLang_verror (SL_INTRINSIC_ERROR, "Unable to open %s", file);
  >              return fp;
  >           }

  > `

See Also

  `SLang_vmessage, SLang_exit_error`

Next Previous Contents