A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/jwerle/throw.h below:

jwerle/throw.h: Create and throw errors easily

Create and throw errors easily

With clib

$ clib install jwerle/throw.h
#include "throw.h"

int
main (void) {
  error_t eperm = error_new(EPERM, "EPERM");
  error_t enoent = error_new(ENOENT, "ENOENT");
  error_t esrch = error_new(ESRCH, "ESRCH");
  error_t eintr = error_new(EINTR, "EINTR");

  throw(&eperm, "Operation not permitted");
  throw(&enoent, "No such file or directory");
  throw(&esrch, "No such process");
  throw(&eintr, "Interrupted system call");

  return 0;
}

You can also set the stream where errors are written to by defining the THROW_FD file descriptor.

THROW_FD = stderr; // or some other `FILE *` pointer

MIT


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4