#include <iostream>
#include <unistd.h> //standard unix system calls
#include <sys/wait.h>
using namespace std;
int main(void) {
int i;
int status;
i = fork();
if(!i) {
cout << "I am the child process, fork returned: " << i << endl;
return 3;
} else {
wait(&status);
status = WEXITSTATUS(status);
cout << "I am the parent. Fork returned " << i
<< " the child exited with " << status << endl;
}
return 0;
}