aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Krahl <guskraro@student.gu.se>2017-10-19 11:57:22 +0000
committerRobin Krahl <guskraro@student.gu.se>2017-10-19 11:57:22 +0000
commitb82dab8827ba9eecf02a1e805b3b9f2e8aed2fb8 (patch)
treefa5fcf01c599efb547befc58a880885d40085697
parent7c90d74d74a5988ceef17f5545c12289d09b4803 (diff)
downloadmidbro-b82dab8827ba9eecf02a1e805b3b9f2e8aed2fb8.tar.gz
midbro-b82dab8827ba9eecf02a1e805b3b9f2e8aed2fb8.tar.bz2
pasad: Check whether U.txt exists before accessing it
-rw-r--r--broccoli/src/pasad.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/broccoli/src/pasad.c b/broccoli/src/pasad.c
index 91b422c..1bb0e26 100644
--- a/broccoli/src/pasad.c
+++ b/broccoli/src/pasad.c
@@ -49,6 +49,10 @@ int main()
char ch='a';
int flag=0;
file=fopen("U.txt", "r");
+ if (!file) {
+ fprintf(stderr, "Could not open U.txt. Aborting.\n");
+ return 1;
+ }
printf(" >Reading U[%dx%d] matrix from .txt file...",L,r);
/* Read all values to an array */
for(i=0;i<L;i++)