From 4423b73d2b76c169e3af9770e0b4ebde91168a8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Fri, 5 Feb 2021 17:39:42 +0100 Subject: add test for read --- src/examples/read.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/examples/read.c (limited to 'src/examples/read.c') diff --git a/src/examples/read.c b/src/examples/read.c new file mode 100644 index 0000000..4b6e20b --- /dev/null +++ b/src/examples/read.c @@ -0,0 +1,20 @@ +#include +#include + +int +main (int argc, char *argv[]) +{ + char read_buf[16] = {}; + + int fd = open ("readme"); + if (fd == -1) { + halt (); + } + printf("opened file with fd %d\n", fd); + + int n = read (fd, read_buf, 16); + printf("read %d bytes:\n", n); + + halt(); + return 0; +} -- cgit v1.2.1