diff options
Diffstat (limited to 'test.c')
-rw-r--r-- | test.c | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -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 |