title: Qt: How to catch an error with system call?
body: <p>I am building a GUI application where I do a system call and call for gnuplot to run a script. Now i want to build in an error message that says when something is wrong (e.g. gnuplot is not installed or in the wrong path).</p>
  
  <p>So I've been thinking about just putting out a QMessageBox, but I don't know how I can check whether the system call succeeded or not.</p>
  
  <pre><code>if(//System call didn't work)
  {
      QMessageBox msgBox;
      msgBox.setWindowTitle("Error");
      msgBox.setIcon(QMessageBox::Critical);
      msgBox.setText("GNUPLOT was not installed");
      msgBox.exec();
  }
  </code></pre>
  
  <p>My system call looks like this:</p>
  
  <pre><code>system(gnuplot script.txt);
  </code></pre>
  
  <p>Any suggestions?</p>