Advertisement
filashkov

Untitled

Oct 21st, 2020
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <sys/types.h>
  3. #include <sys/wait.h>
  4. #include <unistd.h>
  5.  
  6. int main()
  7. {
  8.     printf("Пример буферизации!\n");
  9.     fflush(stdout);
  10.     pid_t pid = fork();
  11.     if (pid == 0)
  12.     {
  13.         printf("SON %d has father %d\n", getpid() ,getppid());
  14.     }
  15.     else
  16.     {
  17.         printf("FATHER %d has father %d\n", getpid() ,getppid());
  18.     }
  19.  
  20.     wait(NULL);
  21.     printf("The End\n");
  22.     return 0;
  23. }
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement