Named Pipe Blocking
<p>I'm currently learning named pipes and I'm trying to make a class around this notion. Here is my test main:</p>

<pre><code>NamedPipe first("firstpipe"); //my class store the pipe name
NamedPipe second("secondpipe");
first.createPipe(); //my class create the pipe :
                    // mkfifo(mPipeName.c_str(), S_IRUSR | S_IWUSR)

second.createPipe();
pid = fork();
if (pid == 0)
 {
  first.openPipeOut(); // my class open with O_WRONLY 
  first &lt;&lt; "first : test of send first " &lt;&lt; "Hello !"; //just an overload
                                                               //to write on fd

  //my problem is here 
  std::string stringtest;
  second.openPipeIn();   //this is opening with O_RDONLY   
  second &gt;&gt; stringtest;   // overload to read
  std::cout &lt;&lt; stringtest &lt;&lt; std::endl; // showing result
 }
else
 {
  std::string stringtest;
  first.openPipeIn(); //opening with O_RDONLY
  first &gt;&gt; stringtest; // overload to read
  std::cout &lt;&lt; stringtest &lt;&lt; std::endl; // showing result

  // my problem is here :
  second.openPipeOut(); // opening with O_WRONLY
  second &lt;&lt; "Second test" &lt;&lt; " Hi !"; // overload to write
 }
return (EXIT_SUCCESS);
}
</code></pre>

<p>The test works perfectly when I don't add this:</p>

<pre><code>std::string stringtest;
second.openPipeIn();   //this is opening with O_RDONLY   
second &gt;&gt; stringtest;   // overload to read
std::cout &lt;&lt; stringtest &lt;&lt; std::endl; // showing result
</code></pre>

<p>and this</p>

<pre><code>second.openPipeOut(); // opening with O_WRONLY
second &lt;&lt; "Second test" &lt;&lt; " Hi !"; // overload to write
</code></pre>

<p>If I do, my program is blocked and does not even show the first chain result.
Is there something I missed?</p>
