Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <unistd.h>
- #include <iostream>
- #include <sys/types.h>
- using namespace std;
- int main(){
- pid_t pid;
- pid = fork();
- if(pid < 0){
- cout<<"Fork Failed";
- return 1;
- }else if(pid == 0){
- cout<<"Child class pid = "<<getpid();
- }else{
- cout<<"Parent class pid = "<<getppid()<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement