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/ex2.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Year 3/System programming/Practicum6/ex2.c (limited to 'Year 3/System programming/Practicum6/ex2.c') diff --git a/Year 3/System programming/Practicum6/ex2.c b/Year 3/System programming/Practicum6/ex2.c new file mode 100644 index 0000000..c64ac9e --- /dev/null +++ b/Year 3/System programming/Practicum6/ex2.c @@ -0,0 +1,17 @@ +#include +#include + +int main() { + int fileDes[2]; + if (pipe(fileDes) < 0) { + perror("pipe"); + return 1; + } + if (close(fileDes[0]) < 0) { + perror("close"); + return 2; + } + char buf = 'a'; + write(fileDes[1], &buf, 1); + return 0; +} -- cgit v1.3.1-26-gb76a