Skip to content

Instantly share code, notes, and snippets.

@webgtx
Created September 8, 2023 04:14
Show Gist options
  • Save webgtx/814c2489fbc1aed36510a9a02f62a4e7 to your computer and use it in GitHub Desktop.
Save webgtx/814c2489fbc1aed36510a9a02f62a4e7 to your computer and use it in GitHub Desktop.
Error and Die - Simple function to exit the program with error code
#include <stdarg.h>
// END - Error and Die
void end(const char *fmt, ...) {
va_list ap;
va_start(ap, fmt);
vfprintf(stdout, fmt, ap);
fprintf(stdout, "\n");
fflsuh(stdout);
va_end(ap);
exit(1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment