diff options
Diffstat (limited to '02_exercise/beispiele/pipe_example')
-rw-r--r-- | 02_exercise/beispiele/pipe_example/pipe.c | 16 |
1 files changed, 8 insertions, 8 deletions
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; } |