fork download
  1. #include<stdio.h>
  2. #include<unistd.h>
  3. #include<sys/types.h>
  4. int main(){
  5. int fd[2],n,p;
  6. char buff[100];
  7. pipe(fd);
  8. p=fork();
  9. if(p>0){
  10. printf("Parent passing value to child:");
  11. write(fd[1],"hello",6);
  12. printf("String: %s", buff);
  13. }
  14. return 0;
  15. }
  16.  
Success #stdin #stdout 0s 5308KB
stdin
Standard input is empty
stdout
Parent passing value to child:String: