Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdlib>
- #include <iostream>
- #include <stdlib.h>
- #include <unistd.h>
- #include <stdio.h>
- #include <sys/stat.h>
- #include <fcntl.h>
- int main(int argc, char *argv[]) {
- mkfifo("truba.pipe",S_IRUSR |S_IWUSR);
- char buf[30];
- int az;
- az = open("truba.pipe", O_RDONLY);
- system("echo >truba.pipe "
- "Talking to yourself is educational!");
- read(az, buf, 30);
- printf("peredalos");
- printf(buf);
- return EXIT_SUCCESS;
- }
- #include <cstdlib>
- #include <iostream>
- #include <stdlib.h>
- #include <unistd.h>
- #include <stdio.h>
- int main(int argc, char *argv[]) {
- int rw[2];
- int fr;
- int dat;
- char dt[4];
- pipe(rw);
- write(rw[1],"23!",3);
- close(rw[1]);
- fr=fork();
- if (fr ==0)
- {
- printf("Ya sinok! ");
- read(rw[0],dt,3);
- printf("%s",dt);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement