aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-05-29 14:15:57 -0700
committerAlon Zakai <alonzakai@gmail.com>2014-05-29 14:15:57 -0700
commitb94433a6eade7332634cfc246ea8fc21fbbac1ac (patch)
treee7e4e7b76571c4ef767759102f221c9d627cefd6
parentb2e680a109d2a8fbc84e58a2c31b619671a78e8c (diff)
show an error in tests/hello_world_file.cpp if we can't open the file; closes #2389
-rw-r--r--tests/hello_world_file.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/hello_world_file.cpp b/tests/hello_world_file.cpp
index 71fb953b..97ea395e 100644
--- a/tests/hello_world_file.cpp
+++ b/tests/hello_world_file.cpp
@@ -1,6 +1,10 @@
#include <stdio.h>
int main() {
FILE *file = fopen("tests/hello_world_file.txt", "rb");
+ if (!file) {
+ printf("cannot open file\n");
+ return 1;
+ }
while (!feof(file)) {
char c = fgetc(file);
if (c != EOF) {