-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherror.cpp
More file actions
45 lines (32 loc) · 863 Bytes
/
error.cpp
File metadata and controls
45 lines (32 loc) · 863 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// name: error.cpp
// version: 1.0
// description: handles error messages
// standard libraries
#include <string>
#include <stdio.h>
// namespaces
using namespace std;
// header file
#include "error.h"
// error handler
void error(int abort, int code, const char *message) {
/*int tui = 0;
if (tui == 1) { tui::display(msg); }
else { perror(temp.c_str()); }*/
// declare variables
string temp;
// build error message
temp = "error %d: ";
temp += message;
temp += '\n';
// declare variables
char buffer[temp.size()];
// insert error code
sprintf (buffer, temp.c_str(), code);
// set data
temp = buffer;
// display message
perror(temp.c_str());
// handle abort
//if (abort == 1) { exit(1); }
}