SHARE
TWEET

Untitled

a guest May 19th, 2017 46 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void RaiseError(int error_number, ...) {
  2.     va_list  params;
  3.     bool fatal = False;
  4.     char description[255];
  5.    
  6.     va_start(params, error_number);
  7.     switch (error_number) {
  8.         case ERR_OPEN_DB:
  9.             {
  10.                 char* db_name = va_arg(params,char*);
  11.                 fatal = True;
  12.                 sprintf(description, "Fatal Error: Unable to open database (%s)",db_name);
  13.             }
  14.             break;
  15.         default:
  16.             sprintf(description, "Unknown Error"); 
  17.     }
  18.     va_end(params);
  19.     puts(description);
  20.     if (fatal) exit(error_number);
  21. }
RAW Paste Data
Want to get better at C?
Learn to code C in 2017
Top