title: showing cmd terminal in qt widgets application
body: <p>I'm trying to pass some cmd commands using system() and I would like to be able to "communicate" with cmd, say I code in <code>system("dir")</code> in my mainwindow.cpp under my clicked function</p>
  
  <p>this is what it looks like for example  </p>
  
  <pre><code>void MainWindow::on_pushButton_login_clicked()
  {
    std::string platform_server_ip  = ui-&gt;lineEdit_platform_server_ip-&gt;text().toStdString();   
  
    if (platform_server_ip == "dir"
  
      {
        QMessageBox::information(this,"Login", "all required log in details are correct");
  
       close();
  
       const char* c = platform_server_ip.c_str();
       system(c);
       system("ipconfig");
  
  
      }
  </code></pre>
  
  <p><em>I would like to know why it behaves like this and if that's normal</em>. I've included  <code>CONFIG   += console</code>
  in my project file, and checked "run in terminal" (tried it also without) but it never shows me my <strong>desired outcome</strong>.</p>
  
  <p>Instead what I get, is a blank terminal that pops up along side my GUI, and then when I enter "dir" in my GUI and hit enter, a cmd window pops up really fast and in less than a second, its gone. I've even tried it with <code>system("ipconfig")</code>and<code>system ("pause")</code> 
  as well as with one system command like this <code>system("ipconfig" "&amp;pause")</code></p>
  
  <p><strong>desired outcome:</strong> is just a normal execution of system("ipconfig"), followed by other system commands, that display the same result as typing them in cmd itself.</p>
  
  <p>I've also tried all this in "qt Console application" and I either get the same result, or the output (what would normally be as output on cmd) is then found in "application output" of qt creator.</p>
  
  <p>Is there another better way I can achieve what I want? 
  I'm truly a noob and would really appreciate some guidance.</p>