diff options
Diffstat (limited to 'Examples/guile/port/port.c')
-rw-r--r-- | Examples/guile/port/port.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Examples/guile/port/port.c b/Examples/guile/port/port.c new file mode 100644 index 000000000..95867b687 --- /dev/null +++ b/Examples/guile/port/port.c @@ -0,0 +1,18 @@ +#include <stdio.h> +#include <errno.h> + +void print_int(FILE *f, int i) +{ + if (fprintf(f, "%d\n", i)<0) + perror("print_int"); +} + +int read_int(FILE *f) +{ + int i; + if (fscanf(f, "%d", &i)!=1) { + fprintf(stderr, "read_int: error reading from file\n"); + perror("read_int"); + } + return i; +} |