Skip to content

Instantly share code, notes, and snippets.

@KevinKu
Created July 3, 2015 04:26
Show Gist options
  • Save KevinKu/6f579a4ac0be48f61464 to your computer and use it in GitHub Desktop.
Save KevinKu/6f579a4ac0be48f61464 to your computer and use it in GitHub Desktop.
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
int main( int argc , char* argv[] )
{
char read[30];
pid_t child ;
int coll[1] ;
pipe(coll);
child = fork();
if( child == 0 )
{
sprintf(read,"%d",coll[0]);
execl( "./show" , "show" , read , NULL );
}
write( coll[1] , "process message\n" , strlen("process message\n") );
return 0 ;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment