mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-09 22:17:33 +02:00
Thrown an error if file cannot be opened.
This commit is contained in:
parent
74b5cc11b7
commit
d18cc7f23a
1 changed files with 2 additions and 0 deletions
|
@ -1063,6 +1063,7 @@ port_type Cyc_io_open_input_file(object str) {
|
||||||
const char *fname = ((string_type *)str)->str;
|
const char *fname = ((string_type *)str)->str;
|
||||||
make_port(p, NULL, 1);
|
make_port(p, NULL, 1);
|
||||||
p.fp = fopen(fname, "r");
|
p.fp = fopen(fname, "r");
|
||||||
|
if (p.fp == NULL) { Cyc_rt_raise2("Unable to open file", str); }
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1070,6 +1071,7 @@ port_type Cyc_io_open_output_file(object str) {
|
||||||
const char *fname = ((string_type *)str)->str;
|
const char *fname = ((string_type *)str)->str;
|
||||||
make_port(p, NULL, 0);
|
make_port(p, NULL, 0);
|
||||||
p.fp = fopen(fname, "w");
|
p.fp = fopen(fname, "w");
|
||||||
|
if (p.fp == NULL) { Cyc_rt_raise2("Unable to open file", str); }
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue