3125a52331/vm/console/files.c

fc349e2cf15e1e11664eb67f38cf4acd59fe042c3125a52331ae6d7a6bb77d0ce92a95ddc2580547
30
}
30
}
31
31
32
int file_readc(VM *vm) {
32
int file_readc(VM *vm) {
33
  int cell = TOS; DROP;
34
  FILE *handle = (FILE *) TOS; DROP;
33
  FILE *handle = (FILE *) TOS; DROP;
35
  int c = fgetc(handle);
34
  int c = fgetc(handle);
36
  vm->image[cell] = c;
37
  if ( c == EOF ) {
35
  if ( c == EOF ) {
38
    return 0;
36
    return 0;
39
  } else {
37
  } else {
40
    return -1;
38
    return c;
41
  }
39
  }
42
}
40
}
43
41