From c21e867c6b272fb6722c46aa0a06d63611d0a373 Mon Sep 17 00:00:00 2001 From: syn Date: Fri, 31 Jan 2020 09:02:55 +0300 Subject: Finished echo with private data --- test.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 test.c (limited to 'test.c') 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 +#include +#include + +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 -- cgit v1.2.1-18-gbd029