Created
September 8, 2023 04:14
-
-
Save webgtx/814c2489fbc1aed36510a9a02f62a4e7 to your computer and use it in GitHub Desktop.
Error and Die - Simple function to exit the program with error code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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