#include #include #include using namespace std; int main() { int status; int pid = fork(); if (pid) { cout << "Parent waiting for child\n"; waitpid(pid, &status, 0); cout << "Parent finished waiting for child\n"; } else { cout << "Child about to run \"ls -l\"\n"; char* args[] = {"ls", "-l", NULL}; execvp(args[0], args); cout << "This should never show unles exec didn't work\n"; } }