title: Catch stderr and stdout from external program in C++
body: <p>I am trying to write a program that runs an external program.</p>
  
  <p>I know that I can catch <code>stdout</code>, and I can catch <code>stdout</code> and <code>stderr</code> together BUT the question is can I catch the <code>stderr</code> and <code>stdout</code> separated?</p>
  
  <p>I mean for example, <code>stderr</code> in variable <code>STDERR</code> and <code>stdout</code> in variable <code>STDOUT</code>. I mean I want them separated.</p>
  
  <p>Also I need the exit code of the external program in a variable.</p>