Child reads the first string sent by parent process by closing the writing end of pipe (fd1[1]) and after reading concatenate both string and passes the string to parent process via fd2 pipe and will exit.
#include <iostream>
using namespace std;
int main() {
string s;
getline(cin,s);
cout<<s<<"aaa"<<endl;
return 0;
}
#include <iostream>
using namespace std;
int main() {
string s;
getline(cin,s);
cout<<s<<"aaa"<<endl;
return 0;
}
Comments
Post a Comment