Skip to content

Instantly share code, notes, and snippets.

@ElijahLynn

ElijahLynn/hello.cpp

Last active Feb 25, 2017
Embed
What would you like to do?
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