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