Skip to content

Commit b94433a

Browse files
committed
show an error in tests/hello_world_file.cpp if we can't open the file; closes #2389
1 parent b2e680a commit b94433a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tests/hello_world_file.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
#include <stdio.h>
22
int main() {
33
FILE *file = fopen("tests/hello_world_file.txt", "rb");
4+
if (!file) {
5+
printf("cannot open file\n");
6+
return 1;
7+
}
48
while (!feof(file)) {
59
char c = fgetc(file);
610
if (c != EOF) {

0 commit comments

Comments
 (0)