Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as C++ by jsdvaasajkdsafaak ( 9 years ago )
#include<iostream>
#include<unistd>
#include<stdlib>
#include<sys>
#include<sys>
using namespace std;
int main(void)
{
    int fd[2];
    pid_t childpid;
    char readbuffer[80];

    pipe(fd);
    childpid = fork();
    if(childpid == 0)
    {
        close(fd[0]);
        write(fd[1],"Are you hearing me?",19);

        cout<<"I can hear you "<<endl;       

        exit(0);
    }
    else
    {

        close(fd[1]);
        read(fd[0], readbuffer, sizeof(readbuffer));
        cout<<readbuffer<<endl;

        cout<<"Loud and clear"<<endl;


    }
    return(0);
}

 

Revise this Paste

Children: 88364
Your Name: Code Language: