-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinput_error.h
More file actions
33 lines (29 loc) · 990 Bytes
/
Copy pathinput_error.h
File metadata and controls
33 lines (29 loc) · 990 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
#ifndef H_ERRORS_H
#define H_ERRORS_H
/*
* These errors should be handled properly by detecting thme and
* returning the proper status code by calling exit(enum error)
*
* NOTE:
* The invalid format error should be raised when you encounter lines that
* contain invalid characters or are not properly formatted. This could happen
* for example, when a line representing an edge from vertex 4 to vertex 5 with weight 10
* is written as (4,5,10 or as 4,5)10 or as 4, 5,10).
*
*/
enum error {
INCORRECT_NUMBER_OF_COMMAND_LINE_ARGUMENTS = 1,
FILE_FAILED_TO_OPEN,
FILE_FAILED_TO_CLOSE,
PARSING_ERROR_INVALID_FORMAT,
PARSING_ERROR_EMPTY_FILE,
INTEGER_IS_NOT_A_VERTEX,
};
/*
* EXAMPLE: If fopen fails to open the file, exit the program with
* the proper error code in this way:
* exit(FILE_FAILED_TO_OPEN);
* Check that the code returned is correct by running your
* program in GDB. The above example would return exit status 2.
*/
#endif