diff options
Diffstat (limited to 'test/wasi/c/read_file.c')
-rw-r--r-- | test/wasi/c/read_file.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/wasi/c/read_file.c b/test/wasi/c/read_file.c new file mode 100644 index 0000000000..40023e29e2 --- /dev/null +++ b/test/wasi/c/read_file.c @@ -0,0 +1,14 @@ +#include <assert.h> +#include <stdio.h> + +int main() { + FILE* file = fopen("/sandbox/input.txt", "r"); + assert(file != NULL); + + char c = fgetc(file); + while (c != EOF) { + int wrote = fputc(c, stdout); + assert(wrote != EOF); + c = fgetc(file); + } +} |