Browse Source

Make a more useful error message when the file does not exist

Jeremiah Orians 3 years ago
parent
commit
a2c8a371a2
1 changed files with 5 additions and 0 deletions
  1. 5 0
      High_level_prototypes/sin.c

+ 5 - 0
High_level_prototypes/sin.c

@@ -30,6 +30,11 @@ int main(int argc, char **argv)
 	}
 
 	FILE* source_file = fopen(argv[1], "r");
+	if(NULL == source_file)
+	{
+		fprintf(stderr, "Was unable to open file: %s please verify the file exits\n", argv[1]);
+		exit(EXIT_FAILURE);
+	}
 	int numbers = 0;
 	int lowers = 0;
 	int upppers = 0;