In this task, the goal is to spawn a new process which can run simultaneously with, and independently of, the original parent process.
pid_t pid = fork();
if (pid == 0)
std::cout << "This is the new process\n";
else if (pid > 0)
std::cout << "This is the original process\n";
std::cerr << "ERROR: Something went wrong\n";
Content is available under GNU Free Documentation License 1.2.