summaryrefslogtreecommitdiffstats
path: root/test.c
diff options
context:
space:
mode:
Diffstat (limited to 'test.c')
-rw-r--r--test.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/test.c b/test.c
new file mode 100644
index 0000000..ca998dd
--- /dev/null
+++ b/test.c
@@ -0,0 +1,15 @@
+#include <unistd.h>
+#include <stdio.h>
+#include <fcntl.h>
+
+int main() {
+ int fd = open("dev", O_RDWR);
+ const char buf[] = "Some string";
+ printf("wrote %d bytes\n", write(fd, buf, sizeof(buf)));
+ char retbuf[256];
+ int bytes_read = read(fd, retbuf, sizeof(retbuf));
+ printf("read %d bytes\n", bytes_read);
+ retbuf[bytes_read] = 0;
+ printf("ret: '%s'\n", retbuf);
+ return 0;
+} \ No newline at end of file