Last active
February 20, 2020 23:38
-
-
Save nvictor/07f35c7d827599e09dda1a5786384e7f to your computer and use it in GitHub Desktop.
Fatal and error functions
This file contains 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> # va_list, va_start, va_end | |
#include <stdio.h> # vprintf | |
#include <stdlib.h> # exit | |
void fatal(const char *format, ...) { | |
va_list args; | |
va_start(args, format); | |
printf("Fatal: "); | |
vprintf(format, args); | |
printf("\n"); | |
va_end(args); | |
exit(1); | |
} | |
void error(const char *format, ...) { | |
va_list args; | |
va_start(args, format); | |
printf("Error: "); | |
vprintf(format, args); | |
printf("\n"); | |
va_end(args); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment