Use new guile_embedded_run target or guile_run target for running the examples like the other target languages (for suppressing stdout if run from top level). Consistency with other target language file renames: use runme.scm for scripts and example.i, example.c for example code. Add class example to examples being tested.
18 lines
298 B
C
18 lines
298 B
C
#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;
|
|
}
|