SHARE
TWEET

Untitled

a guest Feb 19th, 2020 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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]);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top