Advertisement
Guest User

Untitled

a guest
Feb 19th, 2020
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. int status;
  2.  
  3. if ( waitpid(pid, &status, 0) == -1 ) {
  4. perror("waitpid failed");
  5. return EXIT_FAILURE;
  6. }
  7.  
  8. if ( WIFEXITED(status) ) {
  9. // final result
  10. const int es = WEXITSTATUS(status);
  11. printf("Exit status for %d(words in the sentence): %d\n Final result: ", pid, es);
  12.  
  13. char c;
  14. int r;
  15.  
  16. while((r = read(pfd4[0], &c, 1))>0)
  17. {
  18. printf("%c", c);
  19. }
  20.  
  21. printf("\n");
  22. }
  23.  
  24. close(pfd4[0]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement