summaryrefslogtreecommitdiffstats
path: root/02_exercise/beispiele
diff options
context:
space:
mode:
Diffstat (limited to '02_exercise/beispiele')
-rw-r--r--02_exercise/beispiele/pipe_bidirect/log.txt22
-rw-r--r--02_exercise/beispiele/pipe_example/pipe.c16
2 files changed, 26 insertions, 12 deletions
diff --git a/02_exercise/beispiele/pipe_bidirect/log.txt b/02_exercise/beispiele/pipe_bidirect/log.txt
index fbdc2c7..c59b0bb 100644
--- a/02_exercise/beispiele/pipe_bidirect/log.txt
+++ b/02_exercise/beispiele/pipe_bidirect/log.txt
@@ -1,5 +1,19 @@
-[15234]: ping
-[15233]: pong
-[15234]: ping
-[15233]: pong
+[3225581]: ping
+[3225580]: pong
+[3225581]: ping
+[3225580]: pong
+[3225581]: ping
+[3225580]: pong
+[3225581]: ping
+[3225580]: pong
+[3225581]: ping
+[3225580]: pong
+[3225581]: ping
+[3225580]: pong
+[3225581]: ping
+[3225580]: pong
+[3225581]: ping
+[3225580]: pong
+[3225581]: ping
+[3225580]: pong
Programmabbruch durch Nutzer
diff --git a/02_exercise/beispiele/pipe_example/pipe.c b/02_exercise/beispiele/pipe_example/pipe.c
index 3589c63..422e4d5 100644
--- a/02_exercise/beispiele/pipe_example/pipe.c
+++ b/02_exercise/beispiele/pipe_example/pipe.c
@@ -35,26 +35,26 @@ void term(const char *msg) {
int main(void) {
int ret = pipe(pipe_fds);
-
+
if (ret < 0)
term("Couldn't create pipe");
-
+
char out_buf[] = "hello";
ret = write(pipe_fds[1], out_buf, strlen(out_buf) + 1);
-
+
if (ret < 0)
term("Couldn't write to pipe");
-
+
printf("send msg: %s\n", out_buf);
-
+
char in_buf[BUF_SIZE];
memset(in_buf, 0, BUF_SIZE);
-
+
ret = read(pipe_fds[0], in_buf, BUF_SIZE - 1);
-
+
if (ret < 0)
term("Couldn't read from pipe");
-
+
printf("recv msg: %s\n", in_buf);
return 0;
}