diff options
author | Stefan Zabka <zabkaste@hu-berlin.de> | 2020-05-21 17:46:10 +0200 |
---|---|---|
committer | Stefan Zabka <zabkaste@hu-berlin.de> | 2020-05-21 17:46:10 +0200 |
commit | 45b35365a5d0f895caeb6178f5f0a70cfe4464ee (patch) | |
tree | bc291ece0cf297f50ba48e8d874a2145721a445f /02_exercise/beispiele/pipe_example | |
parent | 0465e79da49900bbd66216d979876654f8977e30 (diff) | |
parent | 8da59918c22df70eaec28150867c7e8bfd4bc1ae (diff) | |
download | betriebssysteme-45b35365a5d0f895caeb6178f5f0a70cfe4464ee.tar.gz betriebssysteme-45b35365a5d0f895caeb6178f5f0a70cfe4464ee.zip |
Merge branch 'master' of git.niklashalle.net:uni/sem6/betriebssysteme
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; } |