title: Redirecting a Segfault error message to a file from a C++ program
body: <p>I am getting a Segfault error message outputing after running this command in terminal:</p>
  
  <pre><code>   bash-3.2$ a.out &lt; testfiles/inputs/tst1.txt 2&gt; err.txt 
     [2]+  Done                    gedit err.txt
     Segmentation fault
  </code></pre>
  
  <p>a.out is just running a sorting algorithm.</p>
  
  <p>Now my question is how can I redirect the Seg fault error message into the err.txt file.</p>
  
  <p>Using 2> or other varitaions do not seem to work. </p>
  
  <p>Thanks in advance.</p>