xref: /third_party/node/test/wasi/c/read_file_twice.c (revision 1cb0ef41)
1#include <assert.h>
2#include <stdio.h>
3
4int main() {
5  for (int i = 0; i < 2; i++) {
6    FILE* file = fopen("/sandbox/input.txt", "r");
7    assert(file != NULL);
8
9    char c = fgetc(file);
10    while (c != EOF) {
11      int wrote = fputc(c, stdout);
12      assert(wrote != EOF);
13      c = fgetc(file);
14    }
15  }
16}
17