Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- *
- *OS Lab 6
- *18/08/2015
- *@Tanmay Naik
- */
- 1. Pipe
- #include<stdio.h>
- #include<unistd.h>
- #include<sys/types.h>
- #include<string.h>
- void main()
- {
- int fd[2], pid;
- char *m = "Hello msg";
- char m1;
- pipe(fd);
- pid=fork();
- if(pid==0)
- {
- close(fd[0]);
- write(fd[1],m,strlen(m));
- }
- else
- {
- close(fd[1]);
- while(read(fd[0],&m1,1))
- {
- printf("%c",m1);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement