summaryrefslogtreecommitdiff
path: root/userspace/piper.c
diff options
context:
space:
mode:
authorMiguel <m.i@gmx.at>2018-09-15 00:30:36 +0200
committerMiguel <m.i@gmx.at>2018-09-15 00:30:36 +0200
commitfe7d0332267ef1e62153b685d2b5574ce624a4bc (patch)
tree0c5bb5af4275b55b141ff598d9daedd99eb12603 /userspace/piper.c
parentc4b20a0ebbde1348e1e085e2ea3be35345d92b7c (diff)
reading ext2 files and using our abstractions
Diffstat (limited to 'userspace/piper.c')
-rw-r--r--userspace/piper.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/userspace/piper.c b/userspace/piper.c
new file mode 100644
index 0000000..2272f96
--- /dev/null
+++ b/userspace/piper.c
@@ -0,0 +1,21 @@
+#include <stdio.h>
+int main()
+{
+ int pid=_fork();
+ FILE *f=fopen("~testpipe","rw");
+
+ setvbuf(f,NULL,_IONBF,0);
+
+ if(pid==0)
+ {
+ char buf[2];
+ fread(f,buf,1,1);
+ printf("[%c]\n",buf[0]);
+ }
+ else
+ {
+ char buf="666";
+ fwrite(f,buf,1,1);
+ printf("written\n");
+ }
+}