title: Simple way to call 'cat' from c++?
body: <p>I am writing some C++ code and I need to pre-allocate an array based on the contents of a file. I can definitely read the the file and parse the strings a certain way, but it's must easier to find the proper number from the following Linux one-liner:</p>
  
  <pre><code>cat myfile.txt | grep 'Freqs ---' | sed 's/Freqs ---//g' | wc -w
  </code></pre>
  
  <p>What is the best way to use this single one liner on the file from within the C++ code?</p>