Skip to content

Instantly share code, notes, and snippets.

@ElijahLynn
Last active February 25, 2017 01:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ElijahLynn/fce4cb7cb7fee65a03ab7f06371e3e12 to your computer and use it in GitHub Desktop.
Save ElijahLynn/fce4cb7cb7fee65a03ab7f06371e3e12 to your computer and use it in GitHub Desktop.
Strace: Intro Tutorial - Hello World > Goodbye Child
// 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