Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. #include <sys/types.h>
  2. #include <sys/wait.h>
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <unistd.h>
  6. #include <cstring>
  7. #include <iostream>
  8. int main(int argc, char *argv[])
  9. {
  10.     std::cout<<"This is the child process." <<" My pid is "<<getpid()<<" and my parent's id is "<<getppid()<<std::endl;
  11.     for (int i = 0; i <argc; ++i) {
  12.         std::cout<<argv[i]<<std::endl;
  13.         sleep(2);
  14.     }
  15.     return 51;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement