Last active
February 25, 2017 01:23
-
-
Save ElijahLynn/fce4cb7cb7fee65a03ab7f06371e3e12 to your computer and use it in GitHub Desktop.
Strace: Intro Tutorial - Hello World > Goodbye Child
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Strace: Intro Tutorial by Alex Mah | |
// https://www.youtube.com/watch?v=EG0ihttnEJI | |
#include <iostream> | |
#include <stdio.h> | |
#include <errno.h> | |
#include <unistd.h> | |
#include <stdlib.h> | |
using namespace std; | |
int main() | |
{ | |
cout << "Hello World" << endl; | |
int pid = fork(); | |
if(pid == -1) | |
{ | |
perror("fork"); | |
} | |
else if (pid == 0) | |
{ | |
sleep(3); | |
cout << "Goodbye child" << endl; | |
exit(1); | |
} | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment