From 369a723ba50fc9520b30f4d18cdb347f8b9496ee Mon Sep 17 00:00:00 2001 From: Syndamia Date: Wed, 15 Nov 2023 11:58:16 +0200 Subject: [SP/P6] Solved exercises --- Year 3/System programming/Practicum6/ex3.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Year 3/System programming/Practicum6/ex3.c (limited to 'Year 3/System programming/Practicum6/ex3.c') 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 +#include + +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; +} -- cgit v1.3.1-26-gb76a