Function to notify errors

This commit is contained in:
Dr-Noob
2018-06-22 20:36:56 +02:00
parent ebe49743e5
commit 3199ac739a
5 changed files with 29 additions and 7 deletions

16
global.c Normal file
View File

@@ -0,0 +1,16 @@
#include <stdarg.h>
#include <stdio.h>
#include "global.h"
#define RED "\x1b[31;1m"
#define RESET "\x1b[0m"
void printError(const char *fmt, ...) {
int buffer_size = 4096;
char buffer[buffer_size];
va_list args;
va_start(args, fmt);
vsnprintf(buffer,buffer_size, fmt, args);
va_end(args);
fprintf(stderr,RED "ERROR: "RESET "%s\n",buffer);
}