diff options
[SP/P6] Solved exercises
1 files changed, 16 insertions, 0 deletions
| -rw-r--r-- | Year 3/System programming/Practicum6/ex3.c | 16 |
diff --git a/Year 3/System programming/Practicum6/ex3.c b/Year 3/System programming/Practicum6/ex3.c new file mode 100644 index 0000000..a84d2cb --- /dev/null +++ b/Year 3/System programming/Practicum6/ex3.c @@ -0,0 +1,16 @@ +#include <unistd.h> +#include <stdio.h> + +int main() { + int fileDes[2]; + if (pipe(fileDes) < 0) { + perror("pipe"); + return 1; + } + char buf = 'a'; + write(fileDes[1], &buf, 1); + char obuf; + read(fileDes[0], &obuf, 1); + printf("%c", obuf); + return 0; +} |
