9511_project01

project 1 for algorithms & programming I (9511) prof. Cardozo
Index Commits Files Refs README
commit 64040f84ff4df9058738427b9c22ab636edcfbed
parent aaedd15c3886bdd4865f0e7c94c289e6db8eb58d
Author: klewer-martin <martin.cachari@gmail.com>
Date:   Wed, 10 Feb 2021 21:28:44 -0300

Update: deleted st = OK from read_file call in main.c;

Diffstat:
MMakefile | 18++++++++++++++++++
Mmain.c | 4+++-
2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
@@ -33,3 +33,21 @@ run:
 
 run2: 
     ./main -out output.txt -in input.csv 
+
+run3: 
+    ./main -in -out
+
+run4: 
+    ./main -out output.txt -in 
+
+run5: 
+    ./main -in input.csv -out
+
+run6: 
+    ./main -out -in input.csv 
+
+run7: 
+    ./main -in -out output.txt
+
+run8: 
+    ./main -in input.csv 
diff --git a/main.c b/main.c
@@ -58,12 +58,14 @@ int main(int argc, char * argv[])
 //    Abre el archivo de entrada en modo lectura
     if((fpi = fopen(src, "r")) == NULL) {
         fclose(fpi);
+        print_error(ERROR_READING_FILE);
         return ERROR_READING_FILE;
     }
 
 //    Abre el archivo de salida en modo escritura
     if((fpo = fopen(dest, "w")) == NULL) {
         fclose(fpo);
+        print_error(ERROR_READING_FILE);
         return ERROR_READING_FILE;
     }
 
@@ -73,12 +75,12 @@ int main(int argc, char * argv[])
         if(line != 0) {
             print_file(fpo, country_codes, &country, &date, &infected);
         }
-        st = OK;
     }
 
     if((st != OK) && (st != END_OF_INPUT_FILE)) {
         fclose(fpi);
         fclose(fpo);
+        print_error(st);
         return st;
     }