title: Capturing syscall stdout without writing to file in C/C++
body: <p>I want to read the std output of a system call into a C/C++ string. Can I do this without using a temp file?</p>
  
  <p>Perl</p>
  
  <pre><code>//without file io
  $output = `echo hello`;
  </code></pre>
  
  <p>C++</p>
  
  <pre><code>//with file io
  system ("echo hello &gt; tmp");
  std::fstream file ("tmp");
  std::string s;
  file &gt;&gt; s;
  </code></pre>