379_demos/lab2/demos/pipe.c
2024-09-24 13:44:04 -06:00

17 lines
288 B
C

#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
int main(void) {
char buf[100];
char msg[] = "Mario";
int p[2];
pipe(p);
write(p[1], msg, sizeof(msg));
read(p[0], buf, sizeof(msg));
printf("Out from the pipe: `%s`\n", buf);
}