//------------------------------------------------------------------- // forkdemo,cpp (A revision of our 'pidhello.cpp" example) // // This example shows the Linux 'fork()' library-function being // added to the code for our former 'pidhello.cpp' application. // // to compile: $ g++ forkdemo.cpp -o forkdemo // to execute: $ ./forkdemo // // programmer: ALLAN CRUSE // written on: 04 MAR 2009 //------------------------------------------------------------------- #include // for printf() #include // for fork() int main( int argc, char **argv ) { fork(); printf( "Hello from process %d \n", getpid() ); }