rendered paste body#include <sys/types.h>
#include <unistd.h>
#include <iostream>
using namespace std;
int main()
{
int fd[2];
const char string[] = "Hello, world!\n";
char resstring[14];
if (pipe(fd) == -1)
{
cout << "A terrible error occured. pipe() Termination\n";
abort();
}
cout << fd[0] << '\t' << fd[1] << endl;
if (write(fd[1], string, 14) == -1)
{
cout << "A terrible error occured. Write()Termination\n";
abort();
}
if (read(fd[0], resstring, 14) == -1)
{
cout << "A terrible error occured. Read() Termination\n";
abort();
}
cout << resstring;
close(fd[0]);
close(fd[1]);
return EXIT_SUCCESS;
}