int main ()
{
int p;
p = fork (); // clone the current process. When it returns there are two processes running the code
if (p ==0) { // fork() returns 0 to the "child" process.
printf("child"); // Let the user know that the child is doing something.
exec ("/usr/bin/gedit"); // replace the current process (the child) with the named command. So this runs /usr/bin/gedit
}
// If you get here, you're the parent process
printf ("parent");
return 0;
}