Summary Files Commits Branches @commit @diff @stats
path: root / Year 3 / System programming / Practice06 / ex2.c
diff options
context:
space:
mode:
Commita607349b22f8a201512582e6341fe020527baf62 (patch)
Author
 Syndamia <kamen@syndamia.com>
2023-12-02 21:48:54 +0200
Committer
 Syndamia <kamen@syndamia.com>
2023-12-02 21:48:54 +0200
Files603967786be72bab304a42122112a90f16c20c81 /Year 3/System programming/Practice06/ex2.c
uni-projects-a607349b22f8a201512582e6341fe020527baf62.tar
uni-projects-a607349b22f8a201512582e6341fe020527baf62.tar.gz
uni-projects-a607349b22f8a201512582e6341fe020527baf62.zip
Parent3c791c6c357115d4abf71c318c9e7cd7571ea658 (diff)
[SP/P06] Solved most exercises
1 files changed, 14 insertions, 0 deletions
-rw-r--r--Year 3/System programming/Practice06/ex2.c14
diff --git a/Year 3/System programming/Practice06/ex2.c b/Year 3/System programming/Practice06/ex2.c
new file mode 100644
index 0000000..83749e1
--- /dev/null
+++ b/Year 3/System programming/Practice06/ex2.c
@@ -0,0 +1,14 @@
+#include <unistd.h> // pipe
+#include <stdio.h>
+
+int main(int argc, char* argv[]) {
+ int filedes[2];
+ if (pipe(filedes) < 0) {
+ perror("pipe");
+ return 1;
+ }
+
+ close(filedes[0]);
+ char buf = 'a';
+ write(filedes[1], &buf, 1);
+}